summaryrefslogtreecommitdiff
path: root/libavcodec/videotoolbox.c
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-11-10 16:09:05 +0100
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2018-11-12 12:32:17 +0100
commit233cd89056405c76f01cc6f5315aa566454132fa (patch)
treee0fee5513959f09d04d9ea14631fb40e25d7f652 /libavcodec/videotoolbox.c
parent991cd7915537601ce4b862b981e4ef5d517205dd (diff)
lavc/videotoolbox: Fix cropping with HEVC and H264 videos
videotoolbox returns an already cropped stream which led to double cropping. this issue was introduced with the refactor of the cropping mechanism in commit 07596e4 for h264 and 000fb61 for HEVC. to fix this we set the cropping of the frame and the output frame to 0. Tested-by: ponpon Fixes ticket #7544.
Diffstat (limited to 'libavcodec/videotoolbox.c')
-rw-r--r--libavcodec/videotoolbox.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index ac45e23c16..da7236f100 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -903,6 +903,11 @@ 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");
@@ -969,6 +974,12 @@ static int videotoolbox_hevc_end_frame(AVCodecContext *avctx)
HEVCContext *h = avctx->priv_data;
AVFrame *frame = h->ref->frame;
VTContext *vtctx = avctx->internal->hwaccel_priv_data;
+
+ h->output_frame->crop_right = 0;
+ h->output_frame->crop_left = 0;
+ h->output_frame->crop_top = 0;
+ h->output_frame->crop_bottom = 0;
+
int ret = videotoolbox_common_end_frame(avctx, frame);
vtctx->bitstream_size = 0;
return ret;