From 6ed04fa9a430d2621345aaa70403ba2c15a63834 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Mon, 1 Mar 2021 09:02:53 +0100 Subject: [PATCH] avcodec/videotoolboxenc: set a duration on the frame used to generate the extradata, some encoders (hevc 10bit on kaby lake) otherwise fails. --- libavcodec/videotoolboxenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index cc08cf6..3d6af3b 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -2414,7 +2414,7 @@ static int vtenc_populate_extradata(AVCodecContext *avctx, int status; CVPixelBufferPoolRef pool = NULL; CVPixelBufferRef pix_buf = NULL; - CMTime time; + CMTime time, duration; CMSampleBufferRef buf = NULL; status = vtenc_create_encoder(avctx, @@ -2443,10 +2443,11 @@ static int vtenc_populate_extradata(AVCodecContext *avctx, } time = CMTimeMake(0, avctx->time_base.den); + duration = CMTimeMake(avctx->time_base.den, avctx->time_base.den); status = VTCompressionSessionEncodeFrame(vtctx->session, pix_buf, time, - kCMTimeInvalid, + duration, NULL, NULL, NULL); -- 2.29.2 (Apple Git-129)