aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/native/libav
diff options
context:
space:
mode:
authorXerxes Rånby <[email protected]>2013-04-26 18:01:37 +0200
committerXerxes Rånby <[email protected]>2013-05-10 09:39:48 +0200
commit6d802ec7431ee3d0c96aebf4c378887b0ecd82a0 (patch)
tree42522511c557016f5f3d4653765177185d9fa702 /src/jogl/native/libav
parentb621e895fdc0abfdfdc12cb55182d2223120d110 (diff)
FFMPEGMediaPlayer: Use the Audio codec to decode audio. Also prevent double free of packet memory.
Signed-off-by: Xerxes Rånby <[email protected]>
Diffstat (limited to 'src/jogl/native/libav')
-rw-r--r--src/jogl/native/libav/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/jogl/native/libav/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c b/src/jogl/native/libav/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c
index bb54aea00..72cfc2c95 100644
--- a/src/jogl/native/libav/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c
+++ b/src/jogl/native/libav/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c
@@ -595,10 +595,10 @@ JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_readNex
break;
}
if(HAS_FUNC(sp_avcodec_decode_audio4)) {
- len1 = sp_avcodec_decode_audio4(pAV->pVCodecCtx, pAV->pAFrame, &frameFinished, &packet);
+ len1 = sp_avcodec_decode_audio4(pAV->pACodecCtx, pAV->pAFrame, &frameFinished, &packet);
} else {
#if 0
- len1 = sp_avcodec_decode_audio3(pAV->pVCodecCtx, int16_t *samples, int *frame_size_ptr, &frameFinished, &packet);
+ len1 = sp_avcodec_decode_audio3(pAV->pACodecCtx, int16_t *samples, int *frame_size_ptr, &frameFinished, &packet);
#endif
JoglCommon_throwNewRuntimeException(env, "Unimplemented: FFMPEGMediaPlayer sp_avcodec_decode_audio3 fallback");
return 0;
@@ -690,7 +690,9 @@ JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_readNex
}
// Free the packet that was allocated by av_read_frame
- sp_av_free_packet(&packet);
+ // This code cause a double free and have been commented out.
+ // TODO: check what release the packets memory.
+ // sp_av_free_packet(&packet);
}
return res;
}