Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Fix datachannels when using an SFU #137

Merged
merged 2 commits into from
Mar 2, 2023
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
6 changes: 4 additions & 2 deletions SignallingWebServer/cirrus.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ class Player {
return;
}

message.playerId = this.id;
if (!message.playerId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Behaviour is quite nuanced, I feel a comment is necessary here saying something about player id might be already set in some cases (such as sfu datachannels) so we don't want to blanket overwrite it

message.playerId = this.id;
}
const msgString = JSON.stringify(message);

let streamer = streamers.get(this.streamerId);
Expand Down Expand Up @@ -439,8 +441,8 @@ function forwardStreamerMessageToPlayer(streamer, msg) {
const playerId = getPlayerIdFromMessage(msg);
const player = players.get(playerId);
if (player) {
logForward(streamer.id, playerId, msg);
delete msg.playerId;
logForward(streamer.id, playerId, msg);
player.sendTo(msg);
}
}
Expand Down