gst/matroska/matroska-demux.c: Fix open-ended seeks in matroskademux
authorMark Nauwelaerts <manauw@skynet.be>
Mon, 14 Apr 2008 13:38:32 +0000 (13:38 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Mon, 14 Apr 2008 13:38:32 +0000 (13:38 +0000)
Original commit message from CVS:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_handle_seek_event):
Fix open-ended seeks in matroskademux
Patch by: Mark Nauwelaerts <manauw skynet be>
Fixes: #526557
ChangeLog
common
gst/matroska/matroska-demux.c

index 311f396da4a057f6c0505ff68d82f4f1d197c92a..127c6038f0b1c96996b17a58f989322037834b80 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-04-14  Jan Schmidt  <Jan.Schmidt@sun.com>
+
+       * gst/matroska/matroska-demux.c:
+       (gst_matroska_demux_handle_seek_event):
+       Fix open-ended seeks in matroskademux
+       Patch by: Mark Nauwelaerts <manauw skynet be>
+       Fixes: #526557
+
 2008-04-14  Jan Schmidt  <jan.schmidt@sun.com>
 
        * tests/check/Makefile.am:
diff --git a/common b/common
index bdc5172b0ba183be6d92e58cb51782c23e9f2127..f88ff852da7631ad2d0be835763da6d551a63883 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit bdc5172b0ba183be6d92e58cb51782c23e9f2127
+Subproject commit f88ff852da7631ad2d0be835763da6d551a63883
index b67d78c45d00fc43eea811108af35dd3038edbb0..2b0ea0324a64a2195c4f82c7be21b6beae620c07 100644 (file)
@@ -1397,24 +1397,27 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
   GST_OBJECT_LOCK (demux);
 
   /* if nothing configured, play complete file */
-  if (cur == GST_CLOCK_TIME_NONE)
+  if (!GST_CLOCK_TIME_IS_VALID (cur))
     cur = 0;
-  if (stop == GST_CLOCK_TIME_NONE)
+  if (!GST_CLOCK_TIME_IS_VALID (stop))
     stop = demux->segment.duration;
+  /* prevent some calculations and comparisons involving INVALID */
+  segment_start = demux->segment.start;
+  segment_stop = demux->segment.stop;
+  if (!GST_CLOCK_TIME_IS_VALID (segment_start))
+    segment_start = 0;
+  if (!GST_CLOCK_TIME_IS_VALID (segment_stop))
+    segment_stop = demux->segment.duration;
 
   if (cur_type == GST_SEEK_TYPE_SET)
     segment_start = cur;
   else if (cur_type == GST_SEEK_TYPE_CUR)
-    segment_start = demux->segment.start + cur;
-  else
-    segment_start = demux->segment.start;
+    segment_start += cur;
 
   if (stop_type == GST_SEEK_TYPE_SET)
     segment_stop = stop;
   else if (stop_type == GST_SEEK_TYPE_CUR)
-    segment_stop = demux->segment.stop + stop;
-  else
-    segment_stop = demux->segment.stop;
+    segment_stop += stop;
 
   segment_start = CLAMP (segment_start, 0, demux->segment.duration);
   segment_stop = CLAMP (segment_stop, 0, demux->segment.duration);