From: Nicolas Dufresne Date: Sat, 30 Mar 2013 11:06:59 +0000 (+0000) Subject: segment: Fix seeking when position is slightly outside the segment X-Git-Tag: 1.1.1~168 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab44e14c52555136738ff77aaad48b2eeea46ce6;p=platform%2Fupstream%2Fgstreamer.git segment: Fix seeking when position is slightly outside the segment Very often, when the end of a segment is detected by demuxer, the position is slightly outside the segment boundaries. Currently, if that is the case the base will be set to NONE instead of normal accumulation. This would break non-flushing seeks in oggdemux and most likely other demuxers. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=696899 --- diff --git a/gst/gstsegment.c b/gst/gstsegment.c index 9890be5..e9f4bb8 100644 --- a/gst/gstsegment.c +++ b/gst/gstsegment.c @@ -311,6 +311,9 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate, /* flush resets the running_time */ base = 0; } else { + /* make sure the position is inside the segment start/stop */ + position = CLAMP (position, segment->start, segment->stop); + /* remember the elapsed time */ base = gst_segment_to_running_time (segment, format, position); GST_DEBUG ("updated segment.base: %" G_GUINT64_FORMAT, base);