From 57c7f592689ea9110c4d6ec3b3090bbe1649eea3 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 2 Mar 2012 17:27:30 +0100 Subject: ffmpegdec: Use auto-threads if available, and only slice-threading Slice threading causes less latency (and corruption) --- ext/ffmpeg/gstffmpegdec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index fa2e2f4..918abf8 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -884,11 +884,16 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps) * supports it) */ ffmpegdec->context->debug_mv = ffmpegdec->debug_mv; - if (ffmpegdec->max_threads == 0) - ffmpegdec->context->thread_count = gst_ffmpeg_auto_max_threads (); - else + if (ffmpegdec->max_threads == 0) { + if (!(oclass->in_plugin->capabilities & CODEC_CAP_AUTO_THREADS)) + ffmpegdec->context->thread_count = gst_ffmpeg_auto_max_threads (); + else + ffmpegdec->context->thread_count = 0; + } else ffmpegdec->context->thread_count = ffmpegdec->max_threads; + ffmpegdec->context->thread_type = FF_THREAD_SLICE; + /* open codec - we don't select an output pix_fmt yet, * simply because we don't know! We only get it * during playback... */ -- cgit v1.2.1