This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit a57d38f2f94f00d6a236d358ceab1e061d1a6edc Author: Romain Beauxis <[email protected]> AuthorDate: Tue Nov 17 12:32:29 2026 -0600 Commit: Romain Beauxis <[email protected]> CommitDate: Sat Nov 21 13:32:34 2026 +0000 avformat/hevc: skip leading zero bytes before the first start code H.265 B.2 allows leading_zero_8bits before the first NAL unit of a byte stream. Annex B extradata starting with them failed hvcC writing. The codec string test case passes before this change; it guards the codec string once it comes from hevc.c. --- libavformat/hevc.c | 9 ++++++++- libavformat/tests/codecstring.c | 10 ++++++++++ tests/ref/fate/codecstring | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libavformat/hevc.c b/libavformat/hevc.c index 697d831261..787e6cce16 100644 --- a/libavformat/hevc.c +++ b/libavformat/hevc.c @@ -1366,7 +1366,14 @@ static int parse_configuration_record(HEVCDecoderConfigurationRecord *hvcc, } return 0; - } else if (!(AV_RB24(data) == 1 || AV_RB32(data) == 1)) { + } + + /* leading_zero_8bits may precede the first start code (H.265 B.2) */ + while (size > 4 && !AV_RB32(data)) { + data++; + size--; + } + if (!(AV_RB24(data) == 1 || AV_RB32(data) == 1)) { /* Not a valid Annex B start code prefix */ return AVERROR_INVALIDDATA; } diff --git a/libavformat/tests/codecstring.c b/libavformat/tests/codecstring.c index 091bf04552..bba34a429e 100644 --- a/libavformat/tests/codecstring.c +++ b/libavformat/tests/codecstring.c @@ -75,6 +75,13 @@ static const uint8_t hevc_hvcc_constraints_full[] = { 0x1e, 0xf0, 0x00, 0xfc, 0xfd, 0xf8, 0xf8, 0x00, 0x00, 0x0f, 0x00, }; +static const uint8_t hevc_annexb_leading_zero[] = { + 0x00, 0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, + 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x1e, 0xa0, + 0x14, 0x20, 0x79, 0x65, 0x95, 0x9a, 0x49, 0x32, 0xbc, 0x05, 0xa0, 0x20, + 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x03, 0x03, 0x21, 0x00, +}; + /* hevc_annexb with the maximum of 32 long-term reference pictures */ static const uint8_t hevc_annexb_32_long_term_refs[] = { 0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, @@ -128,6 +135,9 @@ static const TestCase cases[] = { { "hevc-annexb-32-long-term-refs", AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1'), AV_PROFILE_UNKNOWN, hevc_annexb_32_long_term_refs, sizeof(hevc_annexb_32_long_term_refs) }, + { "hevc-annexb-leading-zero", AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1'), + AV_PROFILE_UNKNOWN, hevc_annexb_leading_zero, + sizeof(hevc_annexb_leading_zero) }, { "aac-lc", AV_CODEC_ID_AAC, 0, AV_PROFILE_AAC_LOW, NULL, 0 }, }; diff --git a/tests/ref/fate/codecstring b/tests/ref/fate/codecstring index c1c3be9323..7e7a886c93 100644 --- a/tests/ref/fate/codecstring +++ b/tests/ref/fate/codecstring @@ -12,4 +12,5 @@ hevc-hvcc-profile-space: hvc1.A1.6.L30.90 hevc-hvcc-constraints: hvc1.1.6.L30.90.00.10 hevc-hvcc-constraints-full: hvc1.1.6.L30.90.10.20.30.40.50 hevc-annexb-32-long-term-refs: hvc1.1.6.L30.90 +hevc-annexb-leading-zero: hvc1.1.6.L30.90 aac-lc: mp4a.40.2 -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
