Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix transport-wide CC feedback when simulcast SSRCs are missing #2908

Merged
merged 3 commits into from
Mar 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/ice.c
Original file line number Diff line number Diff line change
Expand Up @@ -3997,6 +3997,20 @@ static gboolean janus_ice_outgoing_transport_wide_cc_feedback(gpointer user_data
}

if(pc && pc->do_transport_wide_cc && medium) {
/* Simulcast layers that have not received data will not have a recorded peer SSRC. */
/* Pick the first layer that has a peer SSRC */
guint32 ssrc_peer = 0;
for(int i = 0; i < 3; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per code style, we don't define variables inside the for loop, so please define i outside.

if(medium->ssrc_peer[i] != 0) {
ssrc_peer = medium->ssrc_peer[i];
break;
}
}
if (ssrc_peer == 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code style: no space between if and bracket.

JANUS_LOG(LOG_WARN, "No peer SSRC, cannot send transport-wide CC feedback\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't display a warning here: in case it happens, this is going to spam the logs a lot, since TWCC feedback is very frequent (5 to 10 times per second by default). I'd make it a LOG_HUGE instead.

return G_SOURCE_CONTINUE;
}

/* Create a transport wide feedback message */
size_t size = 1300;
char rtcpbuf[1300];
Expand Down Expand Up @@ -4065,7 +4079,7 @@ static gboolean janus_ice_outgoing_transport_wide_cc_feedback(gpointer user_data
guint8 feedback_packet_count = pc->transport_wide_cc_feedback_count++;
/* Create RTCP packet */
int len = janus_rtcp_transport_wide_cc_feedback(rtcpbuf, size,
medium->ssrc, medium->ssrc_peer[0], feedback_packet_count, packets_to_process);
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 };
Expand Down