From 015b33bc369f7cf89df349e81790ddf655427316 Mon Sep 17 00:00:00 2001 From: Ilkka Ollakka Date: Sun, 16 May 2010 23:05:07 +0300 Subject: [PATCH] avcodec: blacklist some codecs for multithreading libavcodec doesn't allow multiple threads on some codecs, so blacklist them to have only 1. Not sure if it would be easier just to revert few commits to default whole to 1 thread. I did't spot any other codecs that would exit if thread_count > 1 in libavcodec. Fix #3613 --- modules/codec/avcodec/encoder.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c index 1c0296eb1d..c1b3e802b7 100644 --- a/modules/codec/avcodec/encoder.c +++ b/modules/codec/avcodec/encoder.c @@ -499,6 +499,23 @@ int OpenEncoder( vlc_object_t *p_this ) if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax ) p_context->flags |= CODEC_FLAG_QSCALE; + /* These codecs cause libavcodec to exit if thread_count is > 1. + See libavcodec/mpegvideo_enc.c:MPV_encode_init + */ + if ( i_codec_id == CODEC_ID_FLV1 || + i_codec_id == CODEC_ID_H261 || + i_codec_id == CODEC_ID_LJPEG || + i_codec_id == CODEC_ID_MJPEG || + i_codec_id == CODEC_ID_H263 || + i_codec_id == CODEC_ID_H263P || + i_codec_id == CODEC_ID_MSMPEG4V1 || + i_codec_id == CODEC_ID_MSMPEG4V2 || + i_codec_id == CODEC_ID_MSMPEG4V3 || + i_codec_id == CODEC_ID_WMV1 || + i_codec_id == CODEC_ID_RV10 || + i_codec_id == CODEC_ID_RV20 || + i_codec_id == CODEC_ID_SVQ3 ) + p_enc->i_threads = 1; if ( p_enc->i_threads >= 1 ) avcodec_thread_init( p_context, p_enc->i_threads ); -- 2.39.2