basesink: Update start time when losing state only if we were in PLAYING

If we were in PAUSED, the current clock time and base time don't have much to
do with the running time anymore as the clock might have advanced while we
were PAUSED. The system clock does that for example, audio clocks often don't.

Updating the start time in PAUSED will cause a) the wrong position to be
reported, b) step events to step not just the requested amount but the amount
of time we spent in PAUSED. The start time should only ever be updated when
going from PLAYING to PAUSED to remember the current running time (to be able
to compensate later when going to PLAYING for the clock time advancing while
PAUSED), not when we are already in PAUSED.

Based on a patch by Kishore Arepalli <kishore.arepalli@gmail.com>

The updating of the start time when the state is lost was added in commit
ba943a82c0 to fix the position reporting when
the state is lost. This still works correctly after this change.

https://bugzilla.gnome.org/show_bug.cgi?id=739289
This commit is contained in:
Sebastian Dröge 2016-06-13 18:33:27 +02:00
parent 37713c3388
commit b9a4a2a952

View file

@ -2924,7 +2924,8 @@ gst_base_sink_update_start_time (GstBaseSink * basesink)
GstClock *clock; GstClock *clock;
GST_OBJECT_LOCK (basesink); GST_OBJECT_LOCK (basesink);
if ((clock = GST_ELEMENT_CLOCK (basesink))) { if (GST_STATE (basesink) == GST_STATE_PLAYING
&& (clock = GST_ELEMENT_CLOCK (basesink))) {
GstClockTime now; GstClockTime now;
gst_object_ref (clock); gst_object_ref (clock);