From 24c87b18c242c75162e775ff7a729edce88b6a28 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Wed, 22 Jan 2014 10:26:32 -0300 Subject: [PATCH] h265parser: remove trailling 0x00 bytes as the spec doesn't allow them Just like h264, the spec doesn't allow the last bytes of a NAL to be 0x00. So remove it as it is probably just padding. This is related to https://bugzilla.gnome.org/show_bug.cgi?id=721384 --- gst-libs/gst/codecparsers/gsth265parser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/codecparsers/gsth265parser.c b/gst-libs/gst/codecparsers/gsth265parser.c index cb77fab227..f489947d10 100644 --- a/gst-libs/gst/codecparsers/gsth265parser.c +++ b/gst-libs/gst/codecparsers/gsth265parser.c @@ -1531,7 +1531,10 @@ gst_h265_parser_identify_nalu (GstH265Parser * parser, return GST_H265_PARSER_NO_NAL_END; } - if (off2 > 0 && data[nalu->offset + off2 - 1] == 00) + /* Mini performance improvement: + * We could have a way to store how many 0s were skipped to avoid + * parsing them again on the next NAL */ + while (off2 > 0 && data[nalu->offset + off2 - 1] == 00) off2--; nalu->size = off2; -- 2.34.1