tsdemux: Properly carry over the timestamp

This commit is contained in:
Edward Hervey 2011-12-30 18:17:26 +01:00
parent a3ba21d3b9
commit a646d8d1e2

View file

@ -2229,6 +2229,7 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream)
GList *tmp; GList *tmp;
MpegTSBaseStream *bs = (MpegTSBaseStream *) stream; MpegTSBaseStream *bs = (MpegTSBaseStream *) stream;
GstBuffer *buf; GstBuffer *buf;
GstClockTime ts;
GST_DEBUG_OBJECT (stream->pad, GST_DEBUG_OBJECT (stream->pad,
"stream:%p, pid:0x%04x stream_type:%d state:%d", stream, bs->pid, "stream:%p, pid:0x%04x stream_type:%d state:%d", stream, bs->pid,
@ -2263,19 +2264,24 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream)
stream->currentlist = g_list_reverse (stream->currentlist); stream->currentlist = g_list_reverse (stream->currentlist);
buf = (GstBuffer *) stream->currentlist->data; buf = (GstBuffer *) stream->currentlist->data;
ts = GST_BUFFER_TIMESTAMP (buf);
GST_DEBUG_OBJECT (stream->pad, GST_DEBUG_OBJECT (stream->pad,
"delta %" GST_TIME_FORMAT " stream->pts %" GST_TIME_FORMAT, "ts %" GST_TIME_FORMAT " delta %" GST_TIME_FORMAT " stream->pts %"
GST_TIME_ARGS (demux->pts_delta), GST_TIME_ARGS (stream->pts)); GST_TIME_FORMAT, GST_TIME_ARGS (ts), GST_TIME_ARGS (demux->pts_delta),
GST_TIME_ARGS (stream->pts));
if (GST_CLOCK_TIME_IS_VALID (demux->pts_delta) if (GST_CLOCK_TIME_IS_VALID (demux->pts_delta)
&& GST_CLOCK_TIME_IS_VALID (stream->pts) && GST_CLOCK_TIME_IS_VALID (stream->pts)
&& !GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf))) { && !GST_CLOCK_TIME_IS_VALID (ts)) {
GST_BUFFER_TIMESTAMP (buf) = stream->pts - demux->pts_delta; ts = stream->pts - demux->pts_delta;
} }
for (tmp = stream->currentlist->next; tmp; tmp = tmp->next) { for (tmp = stream->currentlist->next; tmp; tmp = tmp->next) {
buf = gst_buffer_join (buf, (GstBuffer *) tmp->data); buf = gst_buffer_join (buf, (GstBuffer *) tmp->data);
} }
GST_BUFFER_TIMESTAMP (buf) = ts;
GST_DEBUG_OBJECT (stream->pad, GST_DEBUG_OBJECT (stream->pad,
"Pushing buffer with timestamp: %" GST_TIME_FORMAT, "Pushing buffer with timestamp: %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));