summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@intel.com>2021-01-16 16:48:38 +0800
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-01-19 18:38:03 +0000
commitb93315fa6ccea12af31d2f20137f7e6bb1e60564 (patch)
treee7c6826dadef69d722479949fa01ea1e3176141e
parent3e82c1f88e0c21b549813137ee99d70e0c0d116b (diff)
downloadgstreamer-plugins-bad-b93315fa6ccea12af31d2f20137f7e6bb1e60564.tar.gz
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>
-rw-r--r--gst-libs/gst/codecparsers/gstav1parser.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gst-libs/gst/codecparsers/gstav1parser.c b/gst-libs/gst/codecparsers/gstav1parser.c
index c2695e94f..7e4b8614b 100644
--- a/gst-libs/gst/codecparsers/gstav1parser.c
+++ b/gst-libs/gst/codecparsers/gstav1parser.c
@@ -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);
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);
if (ret != GST_AV1_PARSER_OK)
goto error;
+ size_sz = gst_bit_reader_get_pos (&br) / 8 - size_sz;
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,
then the packed bitstream is deemed invalid. */
ret = GST_AV1_PARSER_BITSTREAM_ERROR;