From ad13295acb2b9755134d290deeb2e2a98cc02cb9 Mon Sep 17 00:00:00 2001 From: Steve McFarlin Date: Thu, 10 Sep 2026 12:59:26 -0700 Subject: [PATCH] ICE: Enable TWCC feedback for audio-only connections --- src/ice.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ice.c b/src/ice.c index 7f1f479408..d8ea828b3a 100644 --- a/src/ice.c +++ b/src/ice.c @@ -4167,7 +4167,8 @@ static gboolean janus_ice_outgoing_transport_wide_cc_feedback(gpointer user_data guint32 ssrc_peer = 0; janus_ice_peerconnection_medium *medium = NULL; if(pc) { - /* Find inbound video medium */ + /* Prefer inbound video, falling back to audio if no video has a valid peer SSRC. */ + janus_ice_peerconnection_medium *audio = NULL; janus_mutex_lock(&handle->mutex); GHashTableIter iter; gpointer value; @@ -4190,6 +4191,12 @@ static gboolean janus_ice_outgoing_transport_wide_cc_feedback(gpointer user_data if(medium && ssrc_peer) break; } + if(audio == NULL && m && m->type == JANUS_MEDIA_AUDIO && m->recv && m->ssrc_peer[0] != 0) + audio = m; + } + if(medium == NULL && audio != NULL) { + medium = audio; + ssrc_peer = audio->ssrc_peer[0]; } janus_mutex_unlock(&handle->mutex); } @@ -4271,7 +4278,8 @@ static gboolean janus_ice_outgoing_transport_wide_cc_feedback(gpointer user_data medium->ssrc, ssrc_peer, feedback_packet_count, packets_to_process); /* Enqueue it, we'll send it later */ if(len > 0) { - janus_plugin_rtcp rtcp = { .mindex = medium->mindex, .video = TRUE, .buffer = rtcpbuf, .length = len }; + janus_plugin_rtcp rtcp = { .mindex = medium->mindex, + .video = (medium->type == JANUS_MEDIA_VIDEO), .buffer = rtcpbuf, .length = len }; janus_ice_relay_rtcp_internal(handle, medium, &rtcp, FALSE); } if(packets_to_process != packets) {