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.
Unified · Split
| @@ -91,6 +91,11 @@ static int videotoolbox_postproc_frame(void *avctx, AVFrame *frame) · 90 unmodified lines | |||
| 91 | return AVERROR_EXTERNAL; | 91 | return AVERROR_EXTERNAL; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | frame->crop_right = 0; | ||
| 95 | frame->crop_left = 0; | ||
| 96 | frame->crop_top = 0; | ||
| 97 | frame->crop_bottom = 0; | ||
| 98 | |||
| 94 | frame->data[3] = (uint8_t*)ref->pixbuf; | 99 | frame->data[3] = (uint8_t*)ref->pixbuf; |
| 95 | 100 | ||
| 96 | if (ref->hw_frames_ctx) { | 101 | if (ref->hw_frames_ctx) { |
| @@ -898,11 +903,6 @@ static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame) · 801 unmodified lines | |||
| 898 | AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx); | 903 | AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx); |
| 899 | VTContext *vtctx = avctx->internal->hwaccel_priv_data; | 904 | VTContext *vtctx = avctx->internal->hwaccel_priv_data; |
| 900 | 905 | ||
| 901 | frame->crop_right = 0; | ||
| 902 | frame->crop_left = 0; | ||
| 903 | frame->crop_top = 0; | ||
| 904 | frame->crop_bottom = 0; | ||
| 905 | |||
| 906 | if (vtctx->reconfig_needed == true) { | 906 | if (vtctx->reconfig_needed == true) { |
| 907 | vtctx->reconfig_needed = false; | 907 | vtctx->reconfig_needed = false; |
| 908 | av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox decoder needs reconfig, restarting..\n"); | 908 | av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox decoder needs reconfig, restarting..\n"); |