diff mbox

[FFmpeg-devel] dnxhd: set keyframe/pict_type before calling get_buffer().

Message ID 1491311388-4180-1-git-send-email-rsbultje@gmail.com
State New
Headers show

Commit Message

Ronald S. Bultje April 4, 2017, 1:09 p.m. UTC
This fixes the following tsan warning:

WARNING: ThreadSanitizer: data race (pid=95987)
  Write of size 4 at 0x7d5000004278 by main thread:
    #0 get_frame_defaults frame.c:117 (ffmpeg:x86_64+0x1016c5b18)
[..]
  Previous write of size 4 at 0x7d5000004278 by thread T2:
    [failed to restore the stack]
---
 libavcodec/dnxhddec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ronald S. Bultje April 4, 2017, 1:55 p.m. UTC | #1
Hi,

On Tue, Apr 4, 2017 at 9:09 AM, Ronald S. Bultje <rsbultje@gmail.com> wrote:

> This fixes the following tsan warning:
>
> WARNING: ThreadSanitizer: data race (pid=95987)
>   Write of size 4 at 0x7d5000004278 by main thread:
>     #0 get_frame_defaults frame.c:117 (ffmpeg:x86_64+0x1016c5b18)
> [..]
>   Previous write of size 4 at 0x7d5000004278 by thread T2:
>     [failed to restore the stack]
> ---
>  libavcodec/dnxhddec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
> index 383e64c..77e62a2 100644
> --- a/libavcodec/dnxhddec.c
> +++ b/libavcodec/dnxhddec.c
> @@ -626,10 +626,10 @@ decode_coding_unit:
>          return ret;
>
>      if (first_field) {
> -        if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
> -            return ret;
>          picture->pict_type = AV_PICTURE_TYPE_I;
>          picture->key_frame = 1;
> +        if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
> +            return ret;
>      }
>
>      ctx->buf_size = buf_size - ctx->data_offset;
> --
> 2.8.1


Please hold off reviewing this patch, it may be unnecessary...

Ronald
diff mbox

Patch

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 383e64c..77e62a2 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -626,10 +626,10 @@  decode_coding_unit:
         return ret;
 
     if (first_field) {
-        if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
-            return ret;
         picture->pict_type = AV_PICTURE_TYPE_I;
         picture->key_frame = 1;
+        if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
+            return ret;
     }
 
     ctx->buf_size = buf_size - ctx->data_offset;