mpegtsmux: Remove redundant min_dts
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Mon, 15 Jun 2015 14:08:57 +0000 (10:08 -0400)
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Mon, 15 Jun 2015 14:10:40 +0000 (10:10 -0400)
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
gst/mpegtsmux/mpegtsmux.h

index 208c631..71e2cd8 100644 (file)
@@ -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;
   }
index daceb25..f54342d 100644 (file)
@@ -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;