From 0da15c93c8411f435b37ab7d504a650ee881cb0f Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Tue, 18 Nov 2025 12:46:13 +0800 Subject: [PATCH] avcodec/videotoolboxenc: improve Lock/Unlock BaseAddress error handling 1. Fix continue after CVPixelBufferLockBaseAddress. 2. Remove redundant "Error: " in error message. --- libavcodec/videotoolboxenc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 729072c0b9..c9c4014a6b 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -2414,12 +2414,8 @@ static int copy_avframe_to_pixel_buffer(AVCodecContext *avctx, status = CVPixelBufferLockBaseAddress(cv_img, 0); if (status) { - av_log( - avctx, - AV_LOG_ERROR, - "Error: Could not lock base address of CVPixelBuffer: %d.\n", - status - ); + av_log(avctx, AV_LOG_ERROR, "Could not lock base address of CVPixelBuffer: %d.\n", status); + return AVERROR_EXTERNAL; } if (CVPixelBufferIsPlanar(cv_img)) { @@ -2481,7 +2477,7 @@ static int copy_avframe_to_pixel_buffer(AVCodecContext *avctx, status = CVPixelBufferUnlockBaseAddress(cv_img, 0); if (status) { - av_log(avctx, AV_LOG_ERROR, "Error: Could not unlock CVPixelBuffer base address: %d.\n", status); + av_log(avctx, AV_LOG_ERROR, "Could not unlock CVPixelBuffer base address: %d.\n", status); return AVERROR_EXTERNAL; }