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.
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;
* 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;