summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2020-05-05 14:33:34 +1000
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-05-06 02:53:27 +0000
commit7aa58954c15b1d5e73ae67a39559f87acc6286e9 (patch)
tree5ff667f91244bee8077f7012cf81cf71074f796d /tests
parenta2b0c81900a3e4d37b505f0adac30f92aceb2bcf (diff)
downloadgstreamer-plugins-bad-7aa58954c15b1d5e73ae67a39559f87acc6286e9.tar.gz
tests/webrtc: move bus thread creation earlier
Fixes a small deadlock race where the bus watch GSource could execute before the unlock mutex GSource. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1240>
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/webrtcbin.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/check/elements/webrtcbin.c b/tests/check/elements/webrtcbin.c
index 77e2a8e5d..3473edefb 100644
--- a/tests/check/elements/webrtcbin.c
+++ b/tests/check/elements/webrtcbin.c
@@ -499,6 +499,13 @@ test_webrtc_new (void)
g_mutex_init (&ret->lock);
g_cond_init (&ret->cond);
+ ret->thread = g_thread_new ("test-webrtc", (GThreadFunc) _bus_thread, ret);
+
+ g_mutex_lock (&ret->lock);
+ while (!ret->loop)
+ g_cond_wait (&ret->cond, &ret->lock);
+ g_mutex_unlock (&ret->lock);
+
ret->bus1 = gst_bus_new ();
ret->bus2 = gst_bus_new ();
gst_bus_add_watch (ret->bus1, (GstBusFunc) _bus_watch, ret);
@@ -537,13 +544,6 @@ test_webrtc_new (void)
g_signal_connect_swapped (ret->webrtc2, "notify::ice-connection-state",
G_CALLBACK (_broadcast), ret);
- ret->thread = g_thread_new ("test-webrtc", (GThreadFunc) _bus_thread, ret);
-
- g_mutex_lock (&ret->lock);
- while (!ret->loop)
- g_cond_wait (&ret->cond, &ret->lock);
- g_mutex_unlock (&ret->lock);
-
return ret;
}