[vlc-commits] commit: avcodec: blacklist some codecs for multithreading (Ilkka Ollakka )
git at videolan.org
git at videolan.org
Sun May 16 22:07:09 CEST 2010
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun May 16 23:05:07 2010 +0300| [015b33bc369f7cf89df349e81790ddf655427316] | committer: Ilkka Ollakka
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
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=015b33bc369f7cf89df349e81790ddf655427316
---
modules/codec/avcodec/encoder.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 1c0296e..c1b3e80 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 );
More information about the vlc-commits
mailing list