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.
This commit is contained in:
Anton Khirnov 2024-06-07 09:05:01 +02:00
parent 52ce2d2a04
commit a811ab74f0

View File

@ -262,7 +262,7 @@ static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf,
int i; int i;
for (i = 0; i < buf_size; i++) { for (i = 0; i < buf_size; i++) {
int nut; int nut, layer_id;
pc->state64 = (pc->state64 << 8) | buf[i]; pc->state64 = (pc->state64 << 8) | buf[i];
@ -270,6 +270,11 @@ static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf,
continue; continue;
nut = (pc->state64 >> 2 * 8 + 1) & 0x3F; nut = (pc->state64 >> 2 * 8 + 1) & 0x3F;
layer_id = (pc->state64 >> 11) & 0x3F;
if (layer_id > 0)
continue;
// Beginning of access unit // Beginning of access unit
if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_EOB_NUT) || nut == HEVC_NAL_SEI_PREFIX || if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_EOB_NUT) || nut == HEVC_NAL_SEI_PREFIX ||
(nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) { (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) {