[FFmpeg-devel] [PATCH] submit_thread should also lock the mutex that guards the source avctx (prev_thread->avctx) when calling update_context_from_thread.

Ronald S. Bultje rsbultje at gmail.com
Fri Feb 26 23:49:10 CET 2016


Hi,

On Fri, Feb 26, 2016 at 5:35 PM, Wan-Teh Chang <wtc-at-google.com at ffmpeg.org
> wrote:

> The data race is reported on the |qscale| member of MpegEncContext.


sl->qscale is unconditionally assigned in ff_h264_decode_slice_header(),
which run at the start of each frame. Therefore, qscale is (B), not (A) (it
may be copied, but it's never used, so we don't care) and is free to be
modified after the copy because the copied value is irrelevant.

Now, one could argue that maybe we shouldn't copy the value *at all* if we
don't use it anyway, which would incidentally also make tools like tsan
happy about this particular thingy. I'm not against that, if it doesn't
make the code uglier.

But there is no race here.

Ronald


More information about the ffmpeg-devel mailing list