[FFmpeg-devel] [PATCH v2 06/27] avcodec/vp9: Fix race when attaching side-data for show-existing frame

Anton Khirnov anton at khirnov.net
Wed Apr 10 10:06:58 EEST 2024


Quoting Andreas Rheinhardt (2024-04-08 22:13:44)
> When outputting a show-existing frame, the VP9 decoder simply
> created a reference to said frame and returned it immediately to
> the caller, without waiting for it to have finished decoding.
> In case of frame-threading it is possible for the frame to
> only be decoded while it was waiting to be output.
> This is normally benign.
> 
> But there is one case where it is not: If the user wants
> video encoding parameters to be exported, said side data
> will only be attached to the src AVFrame at the end of
> decoding the frame that is actually being shown. Without
> synchronisation adding said side data in the decoder thread
> and the reads in av_frame_ref() in the output thread
> constitute a data race. This happens e.g. when using the
> venc_data_dump tool with vp90-2-10-show-existing-frame.webm
> from the FATE-suite.
> 
> Fix this by actually waiting for the frame to be output.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
>  libavcodec/vp9.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)

LGTM, though it'd be nice of someone more familiar with this decoder
looked at it.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list