diff options
author | Roland Scheidegger <rscheidegger_lists@hispeed.ch> | 2011-12-21 21:23:21 +0100 |
---|---|---|
committer | Roland Scheidegger <rscheidegger_lists@hispeed.ch> | 2011-12-21 21:23:21 +0100 |
commit | 27a86218e1f9a1ae7d88833c0b8bd08d0547b4c2 (patch) | |
tree | c24e4bfe6b97f3ba8970b79dec656d609812ad99 | |
parent | 6f50ec4dfb4bc53ca1f9a6caaf703281edea86b8 (diff) | |
download | xine-lib-27a86218e1f9a1ae7d88833c0b8bd08d0547b4c2.tar.gz xine-lib-27a86218e1f9a1ae7d88833c0b8bd08d0547b4c2.tar.bz2 |
Fix multithreaded initialization with API change
thread count needs to be set before avcodec_open otherwise it will be stuck
with a single thread at least for h264 (might also want to use avcodec_open2
instead?)
-rw-r--r-- | src/combined/ffmpeg/ff_video_decoder.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 5334b8d71..0b7c2222c 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -324,6 +324,13 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) if (this->class->choose_speed_over_accuracy) this->context->flags2 |= CODEC_FLAG2_FAST; +#ifdef DEPRECATED_AVCODEC_THREAD_INIT + if (this->class->thread_count > 1) { + if (this->codec->id != CODEC_ID_SVQ3) + this->context->thread_count = this->class->thread_count; + } +#endif + pthread_mutex_lock(&ffmpeg_lock); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock(&ffmpeg_lock); @@ -351,14 +358,13 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) } } +#ifndef DEPRECATED_AVCODEC_THREAD_INIT if (this->class->thread_count > 1) { if (this->codec->id != CODEC_ID_SVQ3 -#ifndef DEPRECATED_AVCODEC_THREAD_INIT - && avcodec_thread_init(this->context, this->class->thread_count) != -1 -#endif - ) + && avcodec_thread_init(this->context, this->class->thread_count) != -1) this->context->thread_count = this->class->thread_count; } +#endif this->context->skip_loop_filter = skip_loop_filter_enum_values[this->class->skip_loop_filter_enum]; |