mpegpsdemux: don't scan for the last PTS if the first wasn't found
authorAlessandro Decina <alessandro.d@gmail.com>
Wed, 18 Jan 2012 10:28:26 +0000 (11:28 +0100)
committerAlessandro Decina <alessandro.d@gmail.com>
Wed, 25 Jan 2012 12:06:45 +0000 (13:06 +0100)
gst/mpegdemux/gstmpegdemux.c

index d1f58d0..ec9b613 100644 (file)
@@ -2543,13 +2543,16 @@ gst_flups_sink_get_duration (GstFluPSDemux * demux)
       " in packet starting at %" G_GUINT64_FORMAT,
       demux->first_pts, GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (demux->first_pts)),
       offset);
-  /* scan for last PTS in the stream */
-  offset = demux->sink_segment.stop;
-  gst_flups_demux_scan_backward_ts (demux, &offset, SCAN_PTS, &demux->last_pts);
-  GST_DEBUG_OBJECT (demux, "Last PTS: %" G_GINT64_FORMAT " %" GST_TIME_FORMAT
-      " in packet starting at %" G_GUINT64_FORMAT,
-      demux->last_pts, GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (demux->last_pts)),
-      offset);
+  if (demux->first_pts != G_MAXUINT64) {
+    /* scan for last PTS in the stream */
+    offset = demux->sink_segment.stop;
+    gst_flups_demux_scan_backward_ts (demux, &offset, SCAN_PTS,
+        &demux->last_pts);
+    GST_DEBUG_OBJECT (demux,
+        "Last PTS: %" G_GINT64_FORMAT " %" GST_TIME_FORMAT
+        " in packet starting at %" G_GUINT64_FORMAT, demux->last_pts,
+        GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (demux->last_pts)), offset);
+  }
   /* Detect wrong SCR values */
   if (demux->first_scr > demux->last_scr) {
     GST_DEBUG_OBJECT (demux, "Wrong SCR values detected, searching for "