summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <ts.santos@sisa.samsung.com>2014-01-20 17:24:54 -0300
committerThiago Santos <ts.santos@sisa.samsung.com>2014-01-22 08:49:36 -0300
commit040e81564106dae5b451f06999b664301f3b41d9 (patch)
treecbfe3d63814c7cfba3cb2d5020b288a6a020b1de
parent37df6c117ac116506e076aa6043a60bd6608ffc7 (diff)
downloadgstreamer-plugins-bad-040e81564106dae5b451f06999b664301f3b41d9.tar.gz
h264parser: remove trailling 0x00 bytes as the spec doesn't allow them
The spec states that the last byte of a NAL 'shall not' be 0x00 and it is allowed for byte-stream format to add padding 0x00 for alignment. So our parser should strip any trailling 0x00. https://bugzilla.gnome.org/show_bug.cgi?id=721384
-rw-r--r--gst-libs/gst/codecparsers/gsth264parser.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c
index bd79a6faf..206f00f34 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.c
+++ b/gst-libs/gst/codecparsers/gsth264parser.c
@@ -1298,7 +1298,10 @@ gst_h264_parser_identify_nalu (GstH264NalParser * nalparser,
return GST_H264_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;