This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 6f82db5ad5a10a6b49d1460a7ed4acace5e2c6a9 Author: Zhao Zhili <[email protected]> AuthorDate: Wed Jul 22 17:52:15 2026 +0800 Commit: Zhao Zhili <[email protected]> CommitDate: Wed Jul 29 04:37:36 2026 +0000 avcodec/videotoolboxenc: respect CMTime.timescale when computing timestamps vtenc_cm_to_avpacket converts output CMSampleBuffer timestamps back to codec timebase by dividing pts.value by avctx->time_base.num. This relies on the output CMTime having the same timescale as the one passed to VTCompressionSessionEncodeFrame. Apple does not guarantee this, and the output timescale can differ from the input. Use av_rescale_q with the actual CMTime timescale so that the conversion is correct regardless of what timescale VideoToolbox returns. Signed-off-by: Zhao Zhili <[email protected]> --- libavcodec/videotoolboxenc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 73f0ac161a..85561c0479 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -2221,7 +2221,6 @@ static int vtenc_cm_to_avpacket( size_t out_buf_size; size_t sei_nalu_size = 0; int64_t dts_delta; - int64_t time_base_num; int nalu_count; CMTime pts; CMTime dts; @@ -2328,9 +2327,9 @@ static int vtenc_cm_to_avpacket( } dts_delta = vtctx->dts_delta >= 0 ? vtctx->dts_delta : 0; - time_base_num = avctx->time_base.num; - pkt->pts = pts.value / time_base_num; - pkt->dts = dts.value / time_base_num - dts_delta; + pkt->pts = av_rescale_q(pts.value, (AVRational){1, pts.timescale}, avctx->time_base); + pkt->dts = av_rescale_q(dts.value, (AVRational){1, dts.timescale}, avctx->time_base) + - dts_delta; return 0; } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
