Pass the input through in that case. Fixes a regression since a696b28886. Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/hevc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/libavformat/hevc.c b/libavformat/hevc.c index e1f31ee1bb..6ad26dfadc 100644 --- a/libavformat/hevc.c +++ b/libavformat/hevc.c @@ -958,10 +958,12 @@ static int hvcc_write(AVIOContext *pb, HEVCDecoderConfigurationRecord *hvcc, /* * We need at least one of each: VPS, SPS and PPS. */ - if ((!numNalus[VPS_INDEX] || numNalus[VPS_INDEX] > HEVC_MAX_VPS_COUNT) && !is_lhvc) + if ((flags & FLAG_ARRAY_COMPLETENESS) && + (!numNalus[VPS_INDEX] || numNalus[VPS_INDEX] > HEVC_MAX_VPS_COUNT) && !is_lhvc) return AVERROR_INVALIDDATA; - if (!numNalus[SPS_INDEX] || numNalus[SPS_INDEX] > HEVC_MAX_SPS_COUNT || - !numNalus[PPS_INDEX] || numNalus[PPS_INDEX] > HEVC_MAX_PPS_COUNT) + if ((flags & FLAG_ARRAY_COMPLETENESS) && + (!numNalus[SPS_INDEX] || numNalus[SPS_INDEX] > HEVC_MAX_SPS_COUNT || + !numNalus[PPS_INDEX] || numNalus[PPS_INDEX] > HEVC_MAX_PPS_COUNT)) return AVERROR_INVALIDDATA; /* unsigned int(8) configurationVersion = 1; */ @@ -1212,6 +1214,13 @@ static int write_configuration_record(AVIOContext *pb, const uint8_t *data, flags |= FLAG_IS_NALFF; num_arrays = get_bits(&gbc, 8); + + /* If there are no arrays, there's nothing to parse. */ + if (!num_arrays && !(flags & FLAG_ARRAY_COMPLETENESS)) { + ret = hvcc_write(pb, &hvcc, flags); + goto end; + } + for (int i = 0; i < num_arrays; i++) { int type, num_nalus; -- 2.47.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".