[FFmpeg-devel] libavcodec: inter thread signaling

Anoop Bhagyanath bhagyanath.anoop at gmail.com
Mon Feb 27 11:50:22 CET 2012


hi everyone,

i am looking at the decoding of h264. basically frame level
multi-threading. i find that we have a main thread collecting frames one by
one from
user (via avcodec_decode_video2) and passing on to one of (num_cores+1)
decoding threads spawned. i understand
the usage of input_cond and output_cond condition variables. also
progress_cond to some extent.

*but i do not understand how B frames are handled, ie if we get a B frame
which depends on future frame. does
 the respective thread wait till that future frame is processed by another
decoding thread. OR do we receive
 frames in the proper decoding order (may be due to the way av_read_frame
is implemented) ?

*when a decoding thread needs some data from another frame(basically
another decoding thread), it awaits the
 progress of that thread. but on what basis this other decoding thread know
that someone is waiting for the data
 from him/her. i guess it has to do with the way some ref data structures
are handled. it would be great if someone could direct me
 a proper way to understand the usage of progress_cond and these ref data
structures.

thank you for your time,
bhagya


More information about the ffmpeg-devel mailing list