PR #22799 opened by Jun Zhao (mypopydev) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22799 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22799.patch
lavc/videotoolbox_vp9: fix vpcC flags offset — The 24-bit flags field in the vpcC box was written at p+1 instead of p, one byte past the correct position after the version byte. This left one byte uninitialized and shifted all subsequent fields (profile, level, bitdepth, color info) by one byte, producing a malformed vpcC configuration record. lavc/videotoolboxenc: return SEI parse errors — copy_replace_length_codes() returned the wrong variable (status instead of old_sei_length) when find_sei_end() failed. This discarded the actual error code from SEI parsing, potentially masking failures during H.264 SEI NAL rewriting in the VideoToolbox encoder output path. From f7c04283367269c7aef2505a1839fb3ea9362330 Mon Sep 17 00:00:00 2001 From: Jun Zhao <[email protected]> Date: Sun, 12 Apr 2026 21:28:20 +0800 Subject: [PATCH 1/2] lavc/videotoolboxenc: return SEI parse errors Return the actual find_sei_end() error when SEI appending fails instead of reusing the previous status code. This preserves the real parse failure for callers instead of reporting malformed SEI handling as success. Signed-off-by: Jun Zhao <[email protected]> --- libavcodec/videotoolboxenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 63e93b9d10..cb3571c723 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -2150,7 +2150,7 @@ static int copy_replace_length_codes( uint8_t *new_sei; old_sei_length = find_sei_end(avctx, dst_box, box_len, &new_sei); if (old_sei_length < 0) - return status; + return old_sei_length; wrote_bytes = write_sei(sei, SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35, -- 2.52.0 From 19c4bcae68a16ea893b0558d720dd4a2ecd58f0f Mon Sep 17 00:00:00 2001 From: Jun Zhao <[email protected]> Date: Sun, 12 Apr 2026 22:25:44 +0800 Subject: [PATCH 2/2] lavc/videotoolbox_vp9: fix vpcC flags offset Write the 24-bit vpcC flags field at the current cursor position after the version byte. The previous code wrote to p+1 instead of p, leaving one byte uninitialized between version and flags and shifting all subsequent fields (profile, level, bitdepth, etc.) by one byte. Signed-off-by: Jun Zhao <[email protected]> --- libavcodec/videotoolbox_vp9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/videotoolbox_vp9.c b/libavcodec/videotoolbox_vp9.c index f2cb34fca4..1d3dcce2ec 100644 --- a/libavcodec/videotoolbox_vp9.c +++ b/libavcodec/videotoolbox_vp9.c @@ -83,7 +83,7 @@ CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx) p = vt_extradata; *p++ = 1; /* version */ - AV_WB24(p + 1, 0); /* flags */ + AV_WB24(p, 0); /* flags */ p += 3; *p++ = h->h.profile; -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
