mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
webrtc: fix a slightly racy test
There is no guarantee that the peer data channel has transitioned to open when we do. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1247>
This commit is contained in:
parent
18de5f8f04
commit
d0b20f8bba
1 changed files with 14 additions and 6 deletions
|
@ -1629,7 +1629,13 @@ static const gchar *test_string = "GStreamer WebRTC is awesome!";
|
|||
static void
|
||||
on_message_string (GObject * channel, const gchar * str, struct test_webrtc *t)
|
||||
{
|
||||
gchar *expected = g_object_steal_data (channel, "expected");
|
||||
GstWebRTCDataChannelState state;
|
||||
gchar *expected;
|
||||
|
||||
g_object_get (channel, "ready-state", &state, NULL);
|
||||
fail_unless_equals_int (GST_WEBRTC_DATA_CHANNEL_STATE_OPEN, state);
|
||||
|
||||
expected = g_object_steal_data (channel, "expected");
|
||||
g_assert_cmpstr (expected, ==, str);
|
||||
g_free (expected);
|
||||
|
||||
|
@ -1645,8 +1651,6 @@ have_data_channel_transfer_string (struct test_webrtc *t, GstElement * element,
|
|||
|
||||
g_object_get (our, "ready-state", &state, NULL);
|
||||
fail_unless_equals_int (GST_WEBRTC_DATA_CHANNEL_STATE_OPEN, state);
|
||||
g_object_get (other, "ready-state", &state, NULL);
|
||||
fail_unless_equals_int (GST_WEBRTC_DATA_CHANNEL_STATE_OPEN, state);
|
||||
|
||||
g_object_set_data_full (our, "expected", g_strdup (test_string), g_free);
|
||||
g_signal_connect (our, "on-message-string", G_CALLBACK (on_message_string),
|
||||
|
@ -1704,7 +1708,13 @@ GST_END_TEST;
|
|||
static void
|
||||
on_message_data (GObject * channel, GBytes * data, struct test_webrtc *t)
|
||||
{
|
||||
GBytes *expected = g_object_steal_data (channel, "expected");
|
||||
GstWebRTCDataChannelState state;
|
||||
GBytes *expected;
|
||||
|
||||
g_object_get (channel, "ready-state", &state, NULL);
|
||||
fail_unless_equals_int (GST_WEBRTC_DATA_CHANNEL_STATE_OPEN, state);
|
||||
|
||||
expected = g_object_steal_data (channel, "expected");
|
||||
g_assert_cmpbytes (data, expected);
|
||||
g_bytes_unref (expected);
|
||||
|
||||
|
@ -1721,8 +1731,6 @@ have_data_channel_transfer_data (struct test_webrtc *t, GstElement * element,
|
|||
|
||||
g_object_get (our, "ready-state", &state, NULL);
|
||||
fail_unless_equals_int (GST_WEBRTC_DATA_CHANNEL_STATE_OPEN, state);
|
||||
g_object_get (other, "ready-state", &state, NULL);
|
||||
fail_unless_equals_int (GST_WEBRTC_DATA_CHANNEL_STATE_OPEN, state);
|
||||
|
||||
g_object_set_data_full (our, "expected", g_bytes_ref (data),
|
||||
(GDestroyNotify) g_bytes_unref);
|
||||
|
|
Loading…
Reference in a new issue