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

Handle reversed streams from signaling #189

Merged
Changes from all commits
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
17 changes: 15 additions & 2 deletions src/lib/core/redux/slices/rtcConnection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,21 @@ export const selectStreamsToAccept = createSelector(
const { streams, id: clientId, newJoiner } = client;

for (let i = 0; i < streams.length; i++) {
const streamId = streams[i].id;
const state = streams[i].state;
let streamId = streams[i].id;
let state = streams[i].state;

if (streams?.length > 1 && streams[1].id === "0") {
// Handle case where we get reversed streams from signal-server
// To avoid sending 2 ready_to_receieve_offer and potentially ending up in failed ice state
if (i === 0) {
streamId = streams[1].id
state = streams[1].state
} else if (i === 1) {
streamId = streams[0].id
state = streams[0].state
}
}

if (shouldAcceptStreams) {
// Already connected
if (state === "done_accept") continue;
Expand Down
Loading