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

Commit

Permalink
Fix input not working when using an SFU with multiple peers (#137)
Browse files Browse the repository at this point in the history
* Fix preventing the player id from being overwritten when sending player messages. This is kind of a nasty exception for when the SFU sends it's data channel negotiations.
  • Loading branch information
mcottontensor committed Mar 2, 2023
1 parent ae05939 commit 125e22e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions SignallingWebServer/cirrus.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ class Player {
return;
}

message.playerId = this.id;
// normally we want to indicate what player this message came from
// but in some instances we might already have set this (streamerDataChannels) due to poor choices
if (!message.playerId) {
message.playerId = this.id;
}
const msgString = JSON.stringify(message);

let streamer = streamers.get(this.streamerId);
Expand Down Expand Up @@ -439,8 +443,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

0 comments on commit 125e22e

Please sign in to comment.