[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:1.9.2.20) 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]
> http://git.videolan.org/?p=ffmpeg.git;a=commit;h=37b00b47cbeecd66bb34c5c7c534d016d6e8da24
> [2]
> http://git.videolan.org/?p=ffmpeg.git;a=commit;h=6a9c85944427e3c4355bce67d7f677ec69527bff
> [3]
> http://git.libav.org/?p=libav.git;a=commit;h=37b00b47cbeecd66bb34c5c7c534d016d6e8da24
> [4]
> http://git.libav.org/?p=libav.git;a=commit;h=6a9c85944427e3c4355bce67d7f677ec69527bff
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:
http://git.savannah.gnu.org/cgit/bino.git/commit/?id=3411dab55e1a0dc2d6867e028877ce23812991a5
Best regards,
Martin