From: Ilkka Ollakka Date: Sun, 16 May 2010 20:05:07 +0000 (+0300) Subject: avcodec: blacklist some codecs for multithreading X-Git-Tag: 1.2.0-pre1~6629 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=015b33bc369f7cf89df349e81790ddf655427316;p=vlc 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 --- 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 );