From a1384f990b3c58e933bd0e8c8ec779180f1925bc Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 9 Nov 2009 19:19:25 +0100 Subject: [PATCH] ffmpegdec: Only restore default in AVCodecContext when needed. Resetting default values is currently very complex in libavcodec, so we only call it when needed (i.e. when a context was previously used). Shaves off 10% of the setup of a decoder. --- ext/ffmpeg/gstffmpegdec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index a294e18..b23c6c2 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -714,11 +714,11 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps) GST_OBJECT_UNLOCK (ffmpegdec); gst_ffmpegdec_drain (ffmpegdec); GST_OBJECT_LOCK (ffmpegdec); - } - gst_ffmpegdec_close (ffmpegdec); + gst_ffmpegdec_close (ffmpegdec); - /* set defaults */ - avcodec_get_context_defaults (ffmpegdec->context); + /* and reset the defaults that were set when a context is created */ + avcodec_get_context_defaults (ffmpegdec->context); + } /* set buffer functions */ ffmpegdec->context->get_buffer = gst_ffmpegdec_get_buffer; -- 2.7.4