mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-03 15:06:34 +00:00
tsdemux: Always use current PTS/DTS
This avoids setting old PTS and/or DTS
This commit is contained in:
parent
e25c2e8e74
commit
9abedc97ff
1 changed files with 18 additions and 13 deletions
|
@ -1139,6 +1139,11 @@ gst_ts_demux_record_pts (GstTSDemux * demux, TSDemuxStream * stream,
|
||||||
{
|
{
|
||||||
MpegTSBaseStream *bs = (MpegTSBaseStream *) stream;
|
MpegTSBaseStream *bs = (MpegTSBaseStream *) stream;
|
||||||
|
|
||||||
|
if (pts == -1) {
|
||||||
|
stream->pts = GST_CLOCK_TIME_NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GST_LOG ("pid 0x%04x pts:%" G_GUINT64_FORMAT " at offset %"
|
GST_LOG ("pid 0x%04x pts:%" G_GUINT64_FORMAT " at offset %"
|
||||||
G_GUINT64_FORMAT, bs->pid, pts, offset);
|
G_GUINT64_FORMAT, bs->pid, pts, offset);
|
||||||
|
|
||||||
|
@ -1185,6 +1190,11 @@ gst_ts_demux_record_dts (GstTSDemux * demux, TSDemuxStream * stream,
|
||||||
{
|
{
|
||||||
MpegTSBaseStream *bs = (MpegTSBaseStream *) stream;
|
MpegTSBaseStream *bs = (MpegTSBaseStream *) stream;
|
||||||
|
|
||||||
|
if (dts == -1) {
|
||||||
|
stream->dts = GST_CLOCK_TIME_NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GST_LOG ("pid 0x%04x dts:%" G_GUINT64_FORMAT " at offset %"
|
GST_LOG ("pid 0x%04x dts:%" G_GUINT64_FORMAT " at offset %"
|
||||||
G_GUINT64_FORMAT, bs->pid, dts, offset);
|
G_GUINT64_FORMAT, bs->pid, dts, offset);
|
||||||
|
|
||||||
|
@ -1244,18 +1254,12 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream,
|
||||||
goto discont;
|
goto discont;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.DTS != -1)
|
gst_ts_demux_record_dts (demux, stream, header.DTS, bufferoffset);
|
||||||
gst_ts_demux_record_dts (demux, stream, header.DTS, bufferoffset);
|
gst_ts_demux_record_pts (demux, stream, header.PTS, bufferoffset);
|
||||||
|
|
||||||
if (header.PTS != -1) {
|
GST_DEBUG_OBJECT (base,
|
||||||
gst_ts_demux_record_pts (demux, stream, header.PTS, bufferoffset);
|
"stream PTS %" GST_TIME_FORMAT " DTS %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (stream->pts), GST_TIME_ARGS (stream->dts));
|
||||||
GST_DEBUG_OBJECT (base,
|
|
||||||
"stream PTS %" GST_TIME_FORMAT " DTS %" GST_TIME_FORMAT,
|
|
||||||
GST_TIME_ARGS (stream->pts),
|
|
||||||
GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (header.DTS)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove PES headers */
|
/* Remove PES headers */
|
||||||
GST_DEBUG ("Moving data forward by %d bytes (packet_size:%d, have:%d)",
|
GST_DEBUG ("Moving data forward by %d bytes (packet_size:%d, have:%d)",
|
||||||
|
@ -1500,8 +1504,9 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream)
|
||||||
demux->program->pcr_pid);
|
demux->program->pcr_pid);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (stream->pad,
|
GST_DEBUG_OBJECT (stream->pad,
|
||||||
"Pushing buffer with timestamp: %" GST_TIME_FORMAT,
|
"Pushing buffer with PTS: %" GST_TIME_FORMAT " , DTS: %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
|
GST_TIME_ARGS (GST_BUFFER_PTS (buffer)),
|
||||||
|
GST_TIME_ARGS (GST_BUFFER_DTS (buffer)));
|
||||||
|
|
||||||
res = gst_pad_push (stream->pad, buffer);
|
res = gst_pad_push (stream->pad, buffer);
|
||||||
GST_DEBUG_OBJECT (stream->pad, "Returned %s", gst_flow_get_name (res));
|
GST_DEBUG_OBJECT (stream->pad, "Returned %s", gst_flow_get_name (res));
|
||||||
|
|
Loading…
Reference in a new issue