diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-06-07 09:05:01 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-09-23 17:11:40 +0200 |
commit | a811ab74f01587db8370bd1d8b942a67a45b2e85 (patch) | |
tree | e54a3c0b441d9bfa91a83af1dbace8bf7cd63755 | |
parent | 52ce2d2a04726c7a5d7905ab735ea16cd5990bef (diff) | |
download | ffmpeg-a811ab74f01587db8370bd1d8b942a67a45b2e85.tar.gz |
lavc/hevc/parser: only split packets on NALUs with nuh_layer_id=0
A packet should contain a full access unit, which for multilayer video
should contain all the layers.
-rw-r--r-- | libavcodec/hevc/parser.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c index 8c7444a162..16b40e2b10 100644 --- a/libavcodec/hevc/parser.c +++ b/libavcodec/hevc/parser.c @@ -262,7 +262,7 @@ static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, int i; for (i = 0; i < buf_size; i++) { - int nut; + int nut, layer_id; pc->state64 = (pc->state64 << 8) | buf[i]; @@ -270,6 +270,11 @@ static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, continue; nut = (pc->state64 >> 2 * 8 + 1) & 0x3F; + + layer_id = (pc->state64 >> 11) & 0x3F; + if (layer_id > 0) + continue; + // Beginning of access unit if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_EOB_NUT) || nut == HEVC_NAL_SEI_PREFIX || (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) { |