From d16582feb6d68839797aa30921b15db1723ed817 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 29 Aug 2008 09:59:29 +0000 Subject: [PATCH] ext/ffmpeg/gstffmpegdec.c: Finalizing a decoder that was never used shouldn't trigger an assertion. Original commit message from CVS: * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_finalize), (gst_ffmpegdec_get_buffer), (gst_ffmpegdec_frame): Finalizing a decoder that was never used shouldn't trigger an assertion. Add debug messages for the two other g_assert_if_reached(). --- ChangeLog | 7 +++++++ ext/ffmpeg/gstffmpegdec.c | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 128a4fd7d3..3282185cdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-08-29 Edward Hervey + + * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_finalize), + (gst_ffmpegdec_get_buffer), (gst_ffmpegdec_frame): + Finalizing a decoder that was never used shouldn't trigger an assertion. + Add debug messages for the two other g_assert_if_reached(). + 2008-08-29 Edward Hervey * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new): diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 9b76e4e5fa..d49b09549b 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -358,12 +358,13 @@ gst_ffmpegdec_finalize (GObject * object) { GstFFMpegDec *ffmpegdec = (GstFFMpegDec *) object; - g_assert (!ffmpegdec->opened); - - /* clean up remaining allocated data */ - av_free (ffmpegdec->context); - av_free (ffmpegdec->picture); + if (ffmpegdec->opened) { + /* clean up remaining allocated data */ + av_free (ffmpegdec->context); + av_free (ffmpegdec->picture); + + } G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -862,6 +863,7 @@ gst_ffmpegdec_get_buffer (AVCodecContext * context, AVFrame * picture) } case CODEC_TYPE_AUDIO: default: + GST_ERROR_OBJECT (ffmpegdec, "_get_buffer() should never get called for non-video buffers !"); g_assert_not_reached (); break; } @@ -1856,6 +1858,7 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, in_duration, &outbuf, ret); break; default: + GST_ERROR_OBJECT (ffmpegdec, "Asked to decode non-audio/video frame !"); g_assert_not_reached (); break; }