diff mbox

[FFmpeg-devel,5/6] h264: don't sync pic_id between threads.

Message ID 1490796744-76454-5-git-send-email-rsbultje@gmail.com
State Accepted
Commit e72690b18da064f6c0f04f09ccde72b6636e3159
Headers show

Commit Message

Ronald S. Bultje March 29, 2017, 2:12 p.m. UTC
This is how the ref list manager links bitstream IDs to H264Picture/Ref
objects, and is local to the producer thread. There is no need for the
consumer thread to know the bitstream IDs of its references in their
respective producer threads.

In practice, this fixes the last tsan warnigns when running fate-h264.
---
 libavcodec/h264_picture.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Michael Niedermayer March 31, 2017, 2:08 p.m. UTC | #1
On Wed, Mar 29, 2017 at 10:12:23AM -0400, Ronald S. Bultje wrote:
> This is how the ref list manager links bitstream IDs to H264Picture/Ref
> objects, and is local to the producer thread. There is no need for the
> consumer thread to know the bitstream IDs of its references in their
> respective producer threads.
> 
> In practice, this fixes the last tsan warnigns when running fate-h264.
> ---
>  libavcodec/h264_picture.c | 1 -
>  1 file changed, 1 deletion(-)

patch is probably ok though iam not sure what issue tsan has with this

[...]
Ronald S. Bultje March 31, 2017, 2:13 p.m. UTC | #2
Hi,

On Fri, Mar 31, 2017 at 10:08 AM, Michael Niedermayer <
michael@niedermayer.cc> wrote:

> On Wed, Mar 29, 2017 at 10:12:23AM -0400, Ronald S. Bultje wrote:
> > This is how the ref list manager links bitstream IDs to H264Picture/Ref
> > objects, and is local to the producer thread. There is no need for the
> > consumer thread to know the bitstream IDs of its references in their
> > respective producer threads.
> >
> > In practice, this fixes the last tsan warnigns when running fate-h264.
> > ---
> >  libavcodec/h264_picture.c | 1 -
> >  1 file changed, 1 deletion(-)
>
> patch is probably ok though iam not sure what issue tsan has with this


In multi-slice files, the second slice will re-do the reflist lookup, which
writes to pic_id. At the same time, the next thread would sync pic_id
between decoding instances. The write-while-sync is the reported race
condition.

(The reported race is obviously harmless.)

Ronald
diff mbox

Patch

diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index db96737..2dbe5ee 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -109,7 +109,6 @@  int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src)
     dst->poc           = src->poc;
     dst->frame_num     = src->frame_num;
     dst->mmco_reset    = src->mmco_reset;
-    dst->pic_id        = src->pic_id;
     dst->long_ref      = src->long_ref;
     dst->mbaff         = src->mbaff;
     dst->field_picture = src->field_picture;