From 6bf6429bc1dc1c787a652228ea86c9e8ca466fa5 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Mon, 15 Jun 2015 10:08:57 -0400 Subject: [PATCH] mpegtsmux: Remove redundant min_dts After few iteration, this variable became the same as dts. It's not the min as the name says, but the dts of the current buffer. Simply remove and place with dts. Also move the debug trace to actually print the signed version of the running-time dts. --- gst/mpegtsmux/mpegtsmux.c | 16 ++++++---------- gst/mpegtsmux/mpegtsmux.h | 3 --- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c index 208c631..71e2cd8 100644 --- a/gst/mpegtsmux/mpegtsmux.c +++ b/gst/mpegtsmux/mpegtsmux.c @@ -331,7 +331,6 @@ static void mpegtsmux_pad_reset (MpegTsPadData * pad_data) { pad_data->pid = 0; - pad_data->min_dts = GST_CLOCK_STIME_NONE; pad_data->dts = GST_CLOCK_STIME_NONE; pad_data->prog_id = -1; #if 0 @@ -1066,22 +1065,19 @@ mpegtsmux_clip_inc_running_time (GstCollectPads * pads, sign = gst_segment_to_running_time_full (&cdata->segment, GST_FORMAT_TIME, time, &time); - GST_LOG_OBJECT (cdata->pad, "buffer dts %" GST_TIME_FORMAT " -> %" - GST_STIME_FORMAT " running time", GST_STIME_ARGS (GST_BUFFER_DTS (buf)), - GST_STIME_ARGS (time)); - if (sign > 0) dts = (gint64) time; else dts = -((gint64) time); - if (!GST_CLOCK_TIME_IS_VALID (pad_data->min_dts)) - pad_data->min_dts = dts; + GST_LOG_OBJECT (cdata->pad, "buffer dts %" GST_TIME_FORMAT " -> %" + GST_STIME_FORMAT " running time", GST_TIME_ARGS (GST_BUFFER_DTS (buf)), + GST_STIME_ARGS (dts)); - if (dts < pad_data->min_dts) { + if (GST_CLOCK_STIME_IS_VALID (pad_data->dts) && dts < pad_data->dts) { /* Ignore DTS going backward */ GST_WARNING_OBJECT (cdata->pad, "ignoring DTS going backward"); - dts = pad_data->min_dts; + dts = pad_data->dts; } *outbuf = gst_buffer_make_writable (buf); @@ -1090,7 +1086,7 @@ mpegtsmux_clip_inc_running_time (GstCollectPads * pads, else GST_BUFFER_DTS (*outbuf) = GST_CLOCK_TIME_NONE; - pad_data->dts = pad_data->min_dts = dts; + pad_data->dts = dts; } else { pad_data->dts = GST_CLOCK_STIME_NONE; } diff --git a/gst/mpegtsmux/mpegtsmux.h b/gst/mpegtsmux/mpegtsmux.h index daceb25..f54342d 100644 --- a/gst/mpegtsmux/mpegtsmux.h +++ b/gst/mpegtsmux/mpegtsmux.h @@ -182,9 +182,6 @@ struct MpegTsPadData { gint pid; TsMuxStream *stream; - /* most recent valid DTS for this stream */ - gint64 min_dts; - /* most recent DTS */ gint64 dts; -- 2.7.4