systemclock: Update monotonic reference time when re-scheduling

There is no guarantee that the clock is currently advancing, therefore if we
re-schedule (because of timeouts) a clock wait, we need to re-acquire the
current monotonic clock value against which we will wait.

Avoids spinning the cpu like mad (due to constant timeout) when clocks are
PAUSED.

Fixes #673

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/794>
This commit is contained in:
Edward Hervey 2021-04-13 11:52:06 +02:00 committed by GStreamer Marge Bot
parent daf4e5b410
commit 93e6261db7

View file

@ -1004,6 +1004,7 @@ gst_system_clock_id_wait_jitter_unlocked (GstClock * clock,
/* reschedule if gst_cond_wait_until returned early or we have to reschedule after
* an unlock*/
mono_ts = g_get_monotonic_time ();
now = gst_clock_get_time (clock);
diff = GST_CLOCK_DIFF (now, entryt);