testclock: added single clock id process function
authorTulio Beloqui <tulio.beloqui@pexip.com>
Wed, 19 Jun 2019 11:45:54 +0000 (13:45 +0200)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 4 Dec 2019 16:02:59 +0000 (16:02 +0000)
Co-authored-by: Havard Graff <hgr@pexip.com>
libs/gst/check/gsttestclock.c
libs/gst/check/gsttestclock.h

index 9c7ae8d5dfed9854f4d7144eb230718e8865336b..2804e1ea0dc04c005f528f83468fa9a90f5080ea 100644 (file)
@@ -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
index ff5a69e0e4b9ccd83febbf43ea4ecea43466fcce..a1c1f5a88b9f63b48be34a42275887aafe96a972 100644 (file)
@@ -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);