diff mbox

[FFmpeg-devel] h264: only assign H264Picture::mbaff for first slice.

Message ID 1490874374-99687-1-git-send-email-rsbultje@gmail.com
State Accepted
Commit 1ddc37051f11bd4bbadbcd17ea49b76a965d6a47
Headers show

Commit Message

Ronald S. Bultje March 30, 2017, 11:46 a.m. UTC
The value must be identical between slices, since mbaff depends on
picture_structure and sps, both of which are checked to be identical
to the first slice before this point.

In practice, this silences some tsan warnings in fate-h264.
---
 libavcodec/h264_direct.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer March 31, 2017, 10:27 a.m. UTC | #1
On Thu, Mar 30, 2017 at 07:46:14AM -0400, Ronald S. Bultje wrote:
> The value must be identical between slices, since mbaff depends on
> picture_structure and sps, both of which are checked to be identical
> to the first slice before this point.
> 
> In practice, this silences some tsan warnings in fate-h264.
> ---
>  libavcodec/h264_direct.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

should be ok

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
index 4e7202b..a7a107c 100644
--- a/libavcodec/h264_direct.c
+++ b/libavcodec/h264_direct.c
@@ -138,7 +138,11 @@  void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *
         memcpy(cur->ref_poc[1],   cur->ref_poc[0],   sizeof(cur->ref_poc[0]));
     }
 
-    cur->mbaff = FRAME_MBAFF(h);
+    if (h->current_slice == 0) {
+        cur->mbaff = FRAME_MBAFF(h);
+    } else {
+        av_assert0(cur->mbaff == FRAME_MBAFF(h));
+    }
 
     sl->col_fieldoff = 0;