From c43b5de07d721106aad812db9d0721c3ec748be5 Mon Sep 17 00:00:00 2001 From: gnattu Date: Sat, 10 Aug 2024 14:25:36 +0800 Subject: [PATCH] avutil/hwcontext_videotoolbox: fix leak and console spamming --- ...t-fixes-for-videotoolbox-from-upstream.patch | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/debian/patches/0049-backport-fixes-for-videotoolbox-from-upstream.patch b/debian/patches/0049-backport-fixes-for-videotoolbox-from-upstream.patch index 40caf1227d6..da9a22d4dd1 100644 --- a/debian/patches/0049-backport-fixes-for-videotoolbox-from-upstream.patch +++ b/debian/patches/0049-backport-fixes-for-videotoolbox-from-upstream.patch @@ -291,7 +291,7 @@ Index: FFmpeg/libavcodec/videotoolboxenc.c //Populates extradata - output frames are flushed and param sets are available. status = VTCompressionSessionCompleteFrames(vtctx->session, -@@ -2766,10 +2783,19 @@ static int vtenc_populate_extradata(AVCo +@@ -2766,10 +2783,26 @@ static int vtenc_populate_extradata(AVCo pe_cleanup: CVPixelBufferRelease(pix_buf); @@ -299,9 +299,16 @@ Index: FFmpeg/libavcodec/videotoolboxenc.c + + if (status) { + vtenc_reset(vtctx); -+ } else if (vtctx->session) { -+ CFRelease(vtctx->session); -+ vtctx->session = NULL; ++ } else { ++ if (vtctx->session) { ++ CFRelease(vtctx->session); ++ vtctx->session = NULL; ++ } ++ ++ if (vtctx->supported_props) { ++ CFRelease(vtctx->supported_props); ++ vtctx->supported_props = NULL; ++ } + } + vtctx->frame_ct_out = 0; @@ -390,7 +397,7 @@ Index: FFmpeg/libavutil/hwcontext_videotoolbox.c + colormatrix, kCVAttachmentMode_ShouldPropagate); + else { + CVBufferRemoveAttachment(pixbuf, kCVImageBufferYCbCrMatrixKey); -+ if (src->colorspace != AVCOL_SPC_UNSPECIFIED) ++ if (src->colorspace != AVCOL_SPC_UNSPECIFIED && src->colorspace != AVCOL_SPC_RGB) + av_log(log_ctx, AV_LOG_WARNING, + "Color space %s is not supported.\n", + av_color_space_name(src->colorspace));