[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bino-list] Multithreading video decoding

From: Martin Lambers
Subject: Re: [Bino-list] Multithreading video decoding
Date: Sun, 28 Aug 2011 14:24:10 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110805 Thunderbird/3.1.12

Hi Alexey!

On 27/08/11 23:10, Alexey Osipov wrote:
> Hi Martin and other developers!
> I've just noticed that current git master of bino makes incorrect setup
> of multithreading decoding, which leads to single-threaded decoding in
> all cases. This is relevant for recent versions of ffmpeg and libav.
> After commit [1] (h264 decoder was affected later in [2]) in ffmpeg and
> same commits [3,4] in libav, count of threads for multithreading
> decoding (AVCodecContext::thread_count) must be set _before_ call to
> avcodec_open().
> avcodec_open() calls avcodec_open2(), which calls ff_thread_init(),
> which calls frame_thread_init(), which calls
> validate_thread_parameters().
> validate_thread_parameters() set new AVCodecContext data member named
> "active_thread_type" to correct value using values of
> AVCodecContext::thread_count and AVCodecContext::thread_type.
> If we set AVCodecContext::thread_count _after_ call to avcodec_open(),
> then validate_thread_parameters() got AVCodecContext::thread_count = 1
> and hence set AVCodecContext::active_thread_type configured for
> single-thread decoding.
> I attach a dirty patch, which solve this. I think a real fix should be a
> little different, because we don't want to set `thread_count =
> video_decoding_threads()` for all stream types, but video.
> Best regards,
> Alexey.
> [1] 
> [2] 
> [3] 
> [4] 

Thank you very much for this detailed bug report and analysis! This must
have been difficult to track down.

I applied your fix, along with your suggested check that the stream type
is video, and a comment:

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]