From f05ba0aea7d8740e304b2e32530a728b8e7e61d8 Mon Sep 17 00:00:00 2001 From: Tulio Beloqui Date: Wed, 19 Jun 2019 13:45:54 +0200 Subject: [PATCH] testclock: added single clock id process function Co-authored-by: Havard Graff --- libs/gst/check/gsttestclock.c | 37 +++++++++++++++++++++++++++++++++++ libs/gst/check/gsttestclock.h | 4 ++++ 2 files changed, 41 insertions(+) diff --git a/libs/gst/check/gsttestclock.c b/libs/gst/check/gsttestclock.c index 9c7ae8d5df..2804e1ea0d 100644 --- a/libs/gst/check/gsttestclock.c +++ b/libs/gst/check/gsttestclock.c @@ -1083,6 +1083,43 @@ gst_test_clock_timed_wait_for_multiple_pending_ids (GstTestClock * test_clock, return ret; } + +/** + * gst_test_clock_process_id: + * @test_clock: #GstTestClock for which to process the pending IDs + * @pending_id: (transfer full): #GstClockID + * + * Processes and releases the pending ID. + * + * MT safe. + * + * Since: 1.18 + */ +gboolean +gst_test_clock_process_id (GstTestClock * test_clock, GstClockID pending_id) +{ + GstClockEntryContext *ctx; + + gboolean result = FALSE; + + g_return_val_if_fail (GST_IS_TEST_CLOCK (test_clock), FALSE); + + GST_OBJECT_LOCK (test_clock); + + ctx = gst_test_clock_lookup_entry_context (test_clock, pending_id); + g_assert (ctx); + + if (ctx) { + process_entry_context_unlocked (test_clock, ctx); + result = TRUE; + gst_clock_id_unref (pending_id); + } + + GST_OBJECT_UNLOCK (test_clock); + + return result; +} + /** * gst_test_clock_process_id_list: * @test_clock: #GstTestClock for which to process the pending IDs diff --git a/libs/gst/check/gsttestclock.h b/libs/gst/check/gsttestclock.h index ff5a69e0e4..a1c1f5a88b 100644 --- a/libs/gst/check/gsttestclock.h +++ b/libs/gst/check/gsttestclock.h @@ -127,6 +127,10 @@ gboolean gst_test_clock_timed_wait_for_multiple_pending_ids (GstTestClock * guint timeout_ms, GList ** pending_list); +GST_CHECK_API +gboolean gst_test_clock_process_id (GstTestClock * test_clock, + GstClockID pending_id); + GST_CHECK_API guint gst_test_clock_process_id_list (GstTestClock * test_clock, const GList * pending_list);