mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-13 19:44:10 +00:00
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>
This commit is contained in:
parent
a2b0c81900
commit
7aa58954c1
1 changed files with 7 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue