Hi: I found it's different actions with h264 and hevc when decoded. I try to make it same as blow.
But I have no idea about the code: *libavcode/h264dec.c:609 * *AV_RB32(buf+5) > (unsigned)buf_size* I tried to find the answer in specs, but I failed. So I am not sure that it is valid in hevc. From: Li Kai <wolflee...@gmail.com> Date: Fri, 12 Jul 2024 10:21:17 +0800 Subject: [PATCH] avcodec/hevc: compatible with mixed use of annexb and hvcc on bitstream like h264dec Signed-off-by: Li Kai <wolflee...@gmail.com> --- libavcodec/hevc/hevcdec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index fd143cddab..59e99493d5 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -3290,6 +3290,13 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) s->eos = 0; s->slice_initialized = 0; + if (s->nal_length_size == 4) { + if (length > 8 && AV_RB32(buf) == 1 && AV_RB32(buf+5) > (unsigned)length) { + s->is_nalff = 0; + } else if (length > 3 && AV_RB32(buf) > 1 && AV_RB32(buf) <= (unsigned)length) + s->is_nalff = 1; + } + /* split the input packet into NAL units, so we know the upper bound on the * number of slices in the frame */ ret = ff_h2645_packet_split(&s->pkt, buf, length, s->avctx, s->is_nalff, -- 2.45.1 _______________________________________________ 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".