Skip to content

Commit

Permalink
Allow for set_remote_description to update SSRCes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean-Der committed Sep 21, 2024
1 parent d3c80cf commit fd79336
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/peer_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ void peer_connection_set_remote_description(PeerConnection* pc, const char* sdp_
char* val_start = NULL;
uint32_t* ssrc = NULL;
DtlsSrtpRole role = DTLS_SRTP_ROLE_SERVER;
int is_update = 0;
Agent* agent = &pc->agent;

while ((line = strstr(start, "\r\n"))) {
line = strstr(start, "\r\n");
Expand All @@ -471,6 +473,12 @@ void peer_connection_set_remote_description(PeerConnection* pc, const char* sdp_
strncpy(pc->dtls_srtp.remote_fingerprint, buf + 22, DTLS_SRTP_FINGERPRINT_LENGTH);
}

if (strstr(buf, "a=ice-ufrag") &&
strlen(agent->remote_ufrag) != 0 &&
(strncmp(buf + strlen("a=ice-ufrag:"), agent->remote_ufrag, strlen(agent->remote_ufrag)) == 0)) {
is_update = 1;
}

if (strstr(buf, "a=mid:video")) {
ssrc = &pc->remote_vssrc;
} else if (strstr(buf, "a=mid:audio")) {
Expand All @@ -485,6 +493,10 @@ void peer_connection_set_remote_description(PeerConnection* pc, const char* sdp_
start = line + 2;
}

if (is_update) {
return;
}

if (!pc->b_local_description_created) {
peer_connection_state_new(pc, role, 0);
}
Expand Down

0 comments on commit fd79336

Please sign in to comment.