From d266995323609684d21e08148c13239020ab5627 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 16 Aug 2024 14:47:52 +1000 Subject: [PATCH] tests/webrtcbin: Add a lock around the stats test Prevent any race if both webrtcbin end up generating their statistics simultaneously, however unlikely. Part-of: --- subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c b/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c index 57bc34fdde..b7ecb82179 100644 --- a/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c +++ b/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c @@ -1829,9 +1829,13 @@ _on_stats (GstPromise * promise, gpointer user_data) int i; validate_stats (reply); + + g_mutex_lock (&t->lock); i = GPOINTER_TO_INT (t->user_data); i++; t->user_data = GINT_TO_POINTER (i); + g_mutex_unlock (&t->lock); + if (i >= 2) test_webrtc_signal_state (t, STATE_CUSTOM);