From a86e7c1c1f7b53e0445ad372ffceee955c4139a7 Mon Sep 17 00:00:00 2001 From: Sreerenj Balachandran Date: Fri, 10 Apr 2015 14:07:56 +0300 Subject: [PATCH] codecparser: h265: skip byte alignment bits while parsing slice header Skip the byte alignment bits as per the logic of byte_alignment() provided in hevc specification. This will fix the calculation of slice header size. https://bugzilla.gnome.org/show_bug.cgi?id=747613 --- gst-libs/gst/codecparsers/gsth265parser.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gst-libs/gst/codecparsers/gsth265parser.c b/gst-libs/gst/codecparsers/gsth265parser.c index 970e390127..b07d1a4ae7 100644 --- a/gst-libs/gst/codecparsers/gsth265parser.c +++ b/gst-libs/gst/codecparsers/gsth265parser.c @@ -2185,6 +2185,14 @@ gst_h265_parser_parse_slice_hdr (GstH265Parser * parser, goto error; } + /* Skip the byte alignment bits */ + if (!nal_reader_skip (&nr, 1)) + goto error; + while (!nal_reader_is_byte_aligned (&nr)) { + if (!nal_reader_skip (&nr, 1)) + goto error; + } + slice->header_size = nal_reader_get_pos (&nr); slice->n_emulation_prevention_bytes = nal_reader_get_epb_count (&nr);