]> git.sesse.net Git - ffmpeg/commitdiff
lavc/videotoolboxdec: fix crop handling when multithreaded
authorRodger Combs <rodger.combs@gmail.com>
Sat, 7 Sep 2019 03:31:06 +0000 (22:31 -0500)
committerAman Gupta <aman@tmm1.net>
Sun, 15 Sep 2019 18:13:29 +0000 (11:13 -0700)
This was partially fixed by 233cd89, but it made changes to AVFrame fields
from within end_frame, which doesn't work consistently when multithreading
is enabled. This is what the post_process function is for.

Signed-off-by: Aman Gupta <aman@tmm1.net>
libavcodec/videotoolbox.c

index 67e5b54932635e9b7c6c52cdbe745c4b291df8fe..e9b33701696c1b7a789b99874c9b74d45ed4d5ec 100644 (file)
@@ -91,6 +91,11 @@ static int videotoolbox_postproc_frame(void *avctx, AVFrame *frame)
         return AVERROR_EXTERNAL;
     }
 
+    frame->crop_right = 0;
+    frame->crop_left = 0;
+    frame->crop_top = 0;
+    frame->crop_bottom = 0;
+
     frame->data[3] = (uint8_t*)ref->pixbuf;
 
     if (ref->hw_frames_ctx) {
@@ -898,11 +903,6 @@ static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
     AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
     VTContext *vtctx = avctx->internal->hwaccel_priv_data;
 
-    frame->crop_right = 0;
-    frame->crop_left = 0;
-    frame->crop_top = 0;
-    frame->crop_bottom = 0;
-
     if (vtctx->reconfig_needed == true) {
         vtctx->reconfig_needed = false;
         av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox decoder needs reconfig, restarting..\n");