dashdemux: Only set timestamp to the first buffer of fragments

Setting it to the other parts of the fragment is slightly wrong
and misleading as it isn't accurate enough.
This commit is contained in:
Thiago Santos 2014-05-02 18:32:56 -03:00
parent f09dd7e7a5
commit 173c353716

View file

@ -1899,6 +1899,24 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
GST_TIME_ARGS (stream->current_fragment.timestamp));
GST_BUFFER_PTS (buffer) = stream->current_fragment.timestamp;
if (stream->pending_segment) {
if (demux->timestamp_offset == -1)
demux->timestamp_offset = GST_BUFFER_PTS (buffer);
else
demux->timestamp_offset =
MIN (GST_BUFFER_PTS (buffer), demux->timestamp_offset);
/* And send a newsegment */
gst_pad_push_event (stream->pad, stream->pending_segment);
stream->pending_segment = NULL;
}
/* make timestamp start from 0 by subtracting the offset */
GST_BUFFER_PTS (buffer) -= demux->timestamp_offset;
stream->position = demux->segment.position = GST_BUFFER_PTS (buffer);
} else {
GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE;
}
@ -1910,29 +1928,11 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
}
GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_OFFSET (buffer) =
gst_mpd_client_get_segment_index (stream->active_stream) - 1;
if (stream->pending_segment) {
if (demux->timestamp_offset == -1)
demux->timestamp_offset = GST_BUFFER_PTS (buffer);
else
demux->timestamp_offset =
MIN (GST_BUFFER_PTS (buffer), demux->timestamp_offset);
/* And send a newsegment */
gst_pad_push_event (stream->pad, stream->pending_segment);
stream->pending_segment = NULL;
}
/* make timestamp start from 0 by subtracting the offset */
GST_BUFFER_PTS (buffer) -= demux->timestamp_offset;
stream->position = demux->segment.position = GST_BUFFER_PTS (buffer);
/* accumulate time and size to get this chunk */
stream->download_total_time +=
g_get_monotonic_time () - stream->download_start_time;