webrtcbin: Match unassociated transceiver by kind too

When a new m-line comes in that doesn't have a transceiver, only match
existing transceivers of the same kind.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
This commit is contained in:
Olivier Crête 2021-03-31 11:30:16 -04:00
parent 7db5848376
commit 83e546f935

View file

@ -4527,12 +4527,16 @@ static gboolean
_find_compatible_unassociated_transceiver (GstWebRTCRTPTransceiver * p1,
gconstpointer data)
{
GstWebRTCKind kind = GPOINTER_TO_INT (data);
if (p1->mid)
return FALSE;
if (p1->mline != -1)
return FALSE;
if (p1->stopped)
return FALSE;
if (p1->kind != GST_WEBRTC_KIND_UNKNOWN && p1->kind != kind)
return FALSE;
return TRUE;
}
@ -4659,7 +4663,14 @@ _update_transceivers_from_sdp (GstWebRTCBin * webrtc, SDPSource source,
g_strcmp0 (gst_sdp_media_get_media (media), "video") == 0) {
/* No existing transceiver, find an unused one */
if (!trans) {
trans = _find_transceiver (webrtc, NULL,
GstWebRTCKind kind;
if (g_strcmp0 (gst_sdp_media_get_media (media), "audio") == 0)
kind = GST_WEBRTC_KIND_AUDIO;
else
kind = GST_WEBRTC_KIND_VIDEO;
trans = _find_transceiver (webrtc, GINT_TO_POINTER (kind),
(FindTransceiverFunc) _find_compatible_unassociated_transceiver);
}