h264parse: fix writing NALU prefix for byte-stream output format

Specifically, input may already be in byte-stream format, so sync
bytes should not be misinterpreted as NALU size.
This commit is contained in:
Mark Nauwelaerts 2010-03-29 14:49:06 +02:00
parent 5cabe639ac
commit 7d2e248155

View file

@ -1474,6 +1474,9 @@ gst_h264_parse_write_nal_prefix (GstH264Parse * h264parse, GstBuffer * nal)
nal = gst_buffer_make_writable (nal);
while (offset + 4 <= GST_BUFFER_SIZE (nal)) {
nalu_size = GST_READ_UINT32_BE (GST_BUFFER_DATA (nal) + offset);
/* input may already be in byte-stream */
if (nalu_size == 1)
break;
GST_WRITE_UINT32_BE (GST_BUFFER_DATA (nal) + offset, 0x01);
offset += nalu_size + 4;
}