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.
This commit is contained in:
Edward Hervey 2009-11-09 19:19:25 +01:00
parent 72cd8f1843
commit a1384f990b

View file

@ -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);
/* set defaults */
/* 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;