systemclock: Fix deadlock on clock_nanosleep

Always use the monotonic clock's diff and end time for clock_nanosleep to have predictable behaviour even with other clock types.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/779>
This commit is contained in:
Pieter Willem Jordaan 2021-03-31 21:13:45 +02:00
parent bda42a7a00
commit c899d0a52c

View file

@ -966,7 +966,7 @@ gst_system_clock_id_wait_jitter_unlocked (GstClock * clock,
/* In order to provide more accurate wait, we will use BLOCKING /* In order to provide more accurate wait, we will use BLOCKING
clock_nanosleep for any deadlines at or below 500us */ clock_nanosleep for any deadlines at or below 500us */
struct timespec end; struct timespec end;
GST_TIME_TO_TIMESPEC (entryt, end); GST_TIME_TO_TIMESPEC (mono_ts * 1000 + diff, end);
GST_SYSTEM_CLOCK_ENTRY_UNLOCK ((GstClockEntryImpl *) entry); GST_SYSTEM_CLOCK_ENTRY_UNLOCK ((GstClockEntryImpl *) entry);
waitret = waitret =
clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &end, NULL) == 0; clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &end, NULL) == 0;