avcodec/hevc_sei: Fix check for SEI end

The intention behind the current check seems to be to check for
the rbsp_trailing_bits() syntax structure which is always 0x80
for valid SEI messages. Yet this is wrong: These trailing bits
are not part of the GetBitContext -- they have already been
stripped in ff_h2645_packet_split(). And it is harmful, as
0x80 is a legal SEI message payload type (namely for
Structure of pictures information SEI messages). We ignore this
type of SEI, but because of this bug we also ignored every
SEI message in the same NALU following it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-06-22 11:33:32 +02:00
parent a217c1472d
commit 70dc5fc658

View File

@ -549,12 +549,6 @@ static int decode_nal_sei_message(GetByteContext *gb, void *logctx, HEVCSEI *s,
}
}
static int more_rbsp_data(GetByteContext *gb)
{
return bytestream2_get_bytes_left(gb) > 0 &&
bytestream2_peek_byteu(gb) != 0x80;
}
int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s,
const HEVCParamSets *ps, int type)
{
@ -569,7 +563,7 @@ int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s,
ret = decode_nal_sei_message(&gbyte, logctx, s, ps, type);
if (ret < 0)
return ret;
} while (more_rbsp_data(&gbyte));
} while (bytestream2_get_bytes_left(&gbyte) > 0);
return 1;
}