segment: also intialize the duration
authorStefan Sauer <ensonic@users.sf.net>
Fri, 20 Oct 2017 12:30:42 +0000 (14:30 +0200)
committerStefan Sauer <ensonic@users.sf.net>
Fri, 20 Oct 2017 12:30:42 +0000 (14:30 +0200)
If start and stop are set, calculate the duration and set it too.

gst/gstsegment.c

index f355d4a..f69c6f1 100644 (file)
@@ -364,6 +364,12 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
       segment->offset = 0;
   }
 
+  if (start != -1 && stop != -1) {
+    segment->duration = stop - start;
+  } else {
+    segment->duration = -1;
+  }
+
   segment->start = start;
   segment->stop = stop;
   segment->time = start;