codecparsers: Exclude the size of obu_size when identify OBU.

obu->obu_size does not contain the bytes of obu_size itself, we need
to exclude it when doing the saint check.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1614>
This commit is contained in:
He Junyan 2021-01-16 16:48:38 +08:00 committed by GStreamer Merge Bot
parent 3e82c1f88e
commit b93315fa6c

View file

@ -824,12 +824,16 @@ gst_av1_parser_identify_one_obu (GstAV1Parser * parser, const guint8 * data,
GST_LOG ("identify obu type is %d", obu->obu_type); GST_LOG ("identify obu type is %d", obu->obu_type);
if (obu->header.obu_has_size_field) { if (obu->header.obu_has_size_field) {
guint size_sz = gst_bit_reader_get_pos (&br) / 8;
obu->obu_size = av1_bitstreamfn_leb128 (&br, &ret); obu->obu_size = av1_bitstreamfn_leb128 (&br, &ret);
if (ret != GST_AV1_PARSER_OK) if (ret != GST_AV1_PARSER_OK)
goto error; goto error;
size_sz = gst_bit_reader_get_pos (&br) / 8 - size_sz;
if (obu_length if (obu_length
&& obu_length - 1 - obu->header.obu_extention_flag != obu->obu_size) { && obu_length - 1 - obu->header.obu_extention_flag - size_sz !=
obu->obu_size) {
/* If obu_size and obu_length are both present, but inconsistent, /* If obu_size and obu_length are both present, but inconsistent,
then the packed bitstream is deemed invalid. */ then the packed bitstream is deemed invalid. */
ret = GST_AV1_PARSER_BITSTREAM_ERROR; ret = GST_AV1_PARSER_BITSTREAM_ERROR;