From 767e0e46e9fb600dcdcb39b79b819fd5cea86b2c Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 20 Dec 2019 10:53:21 -0300 Subject: [PATCH] tests-clock: Fix race in test_late_crank There was a case where we started waiting on the clock before setting the clock time, leading to the wait succeeding instead of being late: gsttestclock.c:1073:F:testclock:test_late_crank:0: '1 * GST_SECOND' (1000000000) is not equal to 'context.jitter' (-4000000000) Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/426 Co-authored by: Mathieu Duponchelle --- tests/check/libs/gsttestclock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/check/libs/gsttestclock.c b/tests/check/libs/gsttestclock.c index 2b4333a7f3..8fa100f187 100644 --- a/tests/check/libs/gsttestclock.c +++ b/tests/check/libs/gsttestclock.c @@ -1058,12 +1058,12 @@ GST_START_TEST (test_late_crank) clock_id = gst_clock_new_single_shot_id (clock, 5 * GST_SECOND); context.clock_id = gst_clock_id_ref (clock_id); context.jitter = 0; - worker_thread = - g_thread_new ("worker_thread_a", - test_wait_pending_single_shot_id_sync_worker, &context); /* crank the clock while the pending clock id is in the past */ gst_test_clock_set_time (test_clock, 6 * GST_SECOND); + worker_thread = + g_thread_new ("worker_thread_a", + test_wait_pending_single_shot_id_sync_worker, &context); gst_test_clock_crank (test_clock); /* the clock should have advanced and the wait released */