From 0192717045efda4443473ab6b6973b8c1e7339b3 Mon Sep 17 00:00:00 2001 From: Arnout Vandecappelle Date: Tue, 9 Jun 2009 16:34:04 +0200 Subject: [PATCH] ffmpegdec: don't drop buffers when caps change. Fixes #585257 --- ext/ffmpeg/gstffmpegdec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 04684bef71..9742d3eed7 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -224,6 +224,8 @@ static int gst_ffmpegdec_get_buffer (AVCodecContext * context, static void gst_ffmpegdec_release_buffer (AVCodecContext * context, AVFrame * picture); +static void gst_ffmpegdec_drain (GstFFMpegDec * ffmpegdec); + static void gst_ts_handler_init (GstFFMpegDec * ffmpegdec); static void gst_ts_handler_append (GstFFMpegDec * ffmpegdec, GstBuffer * buffer); @@ -685,6 +687,11 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps) oclass->in_plugin->id = gst_ffmpeg_caps_to_codecid (caps, NULL); /* close old session */ + if (ffmpegdec->opened) { + GST_OBJECT_UNLOCK (ffmpegdec); + gst_ffmpegdec_drain (ffmpegdec); + GST_OBJECT_LOCK (ffmpegdec); + } gst_ffmpegdec_close (ffmpegdec); /* set defaults */