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 <mathieu@centricular.com>
This commit is contained in:
Thibault Saunier 2019-12-20 10:53:21 -03:00 committed by GStreamer Merge Bot
parent 0cb3940c94
commit 767e0e46e9

View file

@ -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 */