mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
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.
This commit is contained in:
parent
039ef83523
commit
f83ea8233b
1 changed files with 5 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue