From c02c8a85ce5c763015787ba3fa8d9c151e25fe4d Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Wed, 21 Jul 2021 17:39:11 +1000 Subject: [PATCH] webrtcbin: silence spurious warning when creating answer transceiver When creating a transceiver when creating an answer, the media kind of the transceiver was never set correctly initially. This would lead to a GST_WARNING being produced about changin a transceiver's media kind. Fix by retrieving the GstSDPMedia kind from the offer instead as the answer GstSDPMedia has not been set as the answer caps have not been chosen yet. Part-of: --- .../tests/check/elements/webrtcbin.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c b/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c index ecb5567e1a..946c584ef6 100644 --- a/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c +++ b/subprojects/gst-plugins-bad/tests/check/elements/webrtcbin.c @@ -1022,6 +1022,16 @@ create_audio_test (void) return t; } +static void +on_new_transceiver_expected_kind (GstWebRTCBin * webrtc, + GstWebRTCRTPTransceiver * trans, gpointer user_data) +{ + GstWebRTCKind kind, expected = GPOINTER_TO_UINT (user_data); + + g_object_get (trans, "kind", &kind, NULL); + fail_unless_equals_int (kind, expected); +} + GST_START_TEST (test_audio) { struct test_webrtc *t = create_audio_test (); @@ -1043,10 +1053,18 @@ GST_START_TEST (test_audio) const gchar *expected_answer_direction[] = { "recvonly", }; VAL_SDP_INIT (answer, on_sdp_media_direction, expected_answer_direction, &answer_setup); + GstWebRTCKind expected_kind = GST_WEBRTC_KIND_AUDIO; /* check that a single stream connection creates the associated number * of media sections */ + g_signal_connect (t->webrtc1, "on-new-transceiver", + G_CALLBACK (on_new_transceiver_expected_kind), + GUINT_TO_POINTER (expected_kind)); + g_signal_connect (t->webrtc2, "on-new-transceiver", + G_CALLBACK (on_new_transceiver_expected_kind), + GUINT_TO_POINTER (expected_kind)); + test_validate_sdp (t, &offer, &answer); test_webrtc_free (t); }