Commit bebf20c9 authored by Josep Torra's avatar Josep Torra Committed by GStreamer Merge Bot

h264parse: do not push wrong PTS with some raw files

Some raw h264 encoded files trigger the assignment of wrong PTS to buffers
when some SEI data is provided. This change prevents it to happen.

Also ensure this behavior is being tested.
parent a4c925f6
......@@ -457,7 +457,7 @@ gst_h264_parse_wrap_nal (GstH264Parse * h264parse, guint format, guint8 * data,
|| format == GST_H264_PARSE_FORMAT_AVC3) {
tmp = GUINT32_TO_BE (size << (32 - 8 * nl));
} else {
/* HACK: nl should always be 4 here, otherwise this won't work.
/* HACK: nl should always be 4 here, otherwise this won't work.
* There are legit cases where nl in avc stream is 2, but byte-stream
* SC is still always 4 bytes. */
nl = 4;
......@@ -2444,7 +2444,7 @@ gst_h264_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
* particularly since our ts not that good they handle seeking etc */
if (h264parse->do_ts)
gst_h264_parse_get_timestamp (h264parse,
&GST_BUFFER_TIMESTAMP (buffer), &GST_BUFFER_DURATION (buffer),
&GST_BUFFER_DTS (buffer), &GST_BUFFER_DURATION (buffer),
h264parse->frame_start);
if (h264parse->keyframe)
......
......@@ -271,6 +271,14 @@ verify_buffer_bs_au (buffer_verify_data_s * vdata, GstBuffer * buffer)
fail_unless (ctx_sink_template == &sinktemplate_bs_au);
/* Currently the parser can only predict DTS when dealing with raw data.
* Ensure that this behavior is being checked here. */
GST_DEBUG ("PTS: %" GST_TIME_FORMAT " DTS: %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_PTS (buffer)),
GST_TIME_ARGS (GST_BUFFER_DTS (buffer)));
fail_if (GST_BUFFER_PTS_IS_VALID (buffer));
fail_unless (GST_BUFFER_DTS_IS_VALID (buffer));
gst_buffer_map (buffer, &map, GST_MAP_READ);
fail_unless (map.size > 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment