[FFmpeg-devel] [PATCH] avcodec/frame_thread_encoder: factorize frame threading

Marton Balint cus at passwd.hu
Sun Apr 7 22:04:46 EEST 2019



On Sun, 7 Apr 2019, Paul B Mahol wrote:

> On 4/7/19, Marton Balint <cus at passwd.hu> wrote:
>> framethread.c is put into libavutil, but is has to be included directly to
>> avoid creating avpriv functions.
>>
>> Functionality should be identical, there is one slight difference: we close
>> the
>> per-thread avcodec contexts in the main thread and not in the workers.
>>
>
> Why?

Factorization is good because threading becomes more readable and can be 
reused later in e.g. filter frame threading.

Per-thread contexts are closed and freed in the main thread because doing 
it in the worker would have required another callback in the thread 
context, and it seems pointless to do it in the workers because 
if you check the current code, avcodec_close is serialized using a mutex.

Regards,
Marton


More information about the ffmpeg-devel mailing list