]> git.sesse.net Git - vlc/commitdiff
avcodec: blacklist some codecs for multithreading
authorIlkka Ollakka <ileoo@videolan.org>
Sun, 16 May 2010 20:05:07 +0000 (23:05 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Sun, 16 May 2010 20:05:07 +0000 (23:05 +0300)
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

index 1c0296eb1d9bb8d877ebe1c3f36c27744375273c..c1b3e802b7b498bd2cb62caa3065461598a1d1f1 100644 (file)
@@ -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 );