rtph264pay: don't add trailing zeros to PPS/SPS

This would happen if input is byte-stream with four-byte
sync markers instead of three-byte ones. The code that
scans for sync markers will place the start of the NALU
on the third-last byte of the NALU sync marker, which
means that any additional zeros may be counted as belonging
to the previous NALU instead of being part of the next sync
marker. Fix that so we don't send SPS/PPS with trailing
zeros in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=732758
This commit is contained in:
Philip Craig 2014-07-05 06:21:48 +00:00 committed by Tim-Philipp Müller
parent a9e57f3608
commit ec11b228a4

View file

@ -701,6 +701,10 @@ gst_rtp_h264_pay_decode_nal (GstRtpH264Pay * payloader,
if (SPS_TYPE_ID == type || PPS_TYPE_ID == type) {
GstBuffer *nal;
/* trailing 0x0 are not part of the SPS/PPS */
while (size > 0 && data[size - 1] == 0x0)
size--;
/* encode the entire SPS NAL in base64 */
GST_DEBUG ("Found %s %x %x %x Len=%u", type == SPS_TYPE_ID ? "SPS" : "PPS",
(header >> 7), (header >> 5) & 3, type, size);