summaryrefslogtreecommitdiff
path: root/libs/gst/base
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@noraisin.net>2009-11-11 17:12:19 +0000
committerJan Schmidt <thaytan@noraisin.net>2009-11-11 17:12:19 +0000
commitf83ea8233bf1661bdab0d4ec6f08169d7c664452 (patch)
treec94a150482a97cf20d048c26b5f0f80153b23a79 /libs/gst/base
parent039ef8352387646434f537138007797ac02c325c (diff)
basesink: Fix treating base_time as unsigned in position calculation
Element base_time is a signed quantity, which leads to basesink returning a position of 0 when dealing with a negative base time - which are quite legal when clocks (such as the audio clock) are close to 0. This doesn't manifest in normal pipelines, of course - but can happen (at least) when manually setting the base time on a pipeline.
Diffstat (limited to 'libs/gst/base')
-rw-r--r--libs/gst/base/gstbasesink.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c
index c7f06a4124..7bc76a36d0 100644
--- a/libs/gst/base/gstbasesink.c
+++ b/libs/gst/base/gstbasesink.c
@@ -4294,7 +4294,8 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
GstClock *clock;
gboolean res = FALSE;
GstFormat oformat, tformat;
- GstClockTime now, base, latency;
+ GstClockTime now, latency;
+ GstClockTimeDiff base;
gint64 time, accum, duration;
gdouble rate;
gint64 last;
@@ -4375,9 +4376,10 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
* rate and applied rate. */
base += accum;
base += latency;
- base = MIN (now, base);
+ if (GST_CLOCK_DIFF (base, now) < 0)
+ base = -now;
- /* for negative rates we need to count back from from the segment
+ /* for negative rates we need to count back from the segment
* duration. */
if (rate < 0.0)
time += duration;