From 7d2e2481558b150b0ed0103e9fad5bed735dd63d Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Mon, 29 Mar 2010 14:49:06 +0200 Subject: [PATCH] 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. --- gst/h264parse/gsth264parse.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gst/h264parse/gsth264parse.c b/gst/h264parse/gsth264parse.c index 806c5ab5a2..0f23660c21 100644 --- a/gst/h264parse/gsth264parse.c +++ b/gst/h264parse/gsth264parse.c @@ -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; } -- 2.34.1