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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1664>
This commit is contained in:
Matthew Waters 2021-07-21 17:39:11 +10:00 committed by GStreamer Marge Bot
parent 246374c4e7
commit c02c8a85ce

View file

@ -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);
}