Skip to content

Commit

Permalink
Don't remove streams that still have tracks (#2104)
Browse files Browse the repository at this point in the history
If a renogotiation ends up with one track being removed, we removed
the whole stream, which would cause us to lose, for example, audio
rather than just video.
  • Loading branch information
dbkr authored and robertlong committed Mar 1, 2022
1 parent 2a0dc39 commit ee4cbd1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/webrtc/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1888,8 +1888,10 @@ export class MatrixCall extends EventEmitter {
const stream = ev.streams[0];
this.pushRemoteFeed(stream);
stream.addEventListener("removetrack", () => {
logger.log(`Call ${this.callId} removing track streamId: ${stream.id}`);
this.deleteFeedByStream(stream);
if (stream.getTracks().length === 0) {
logger.log(`Call ${this.callId} removing track streamId: ${stream.id}`);
this.deleteFeedByStream(stream);
}
});
};

Expand Down

0 comments on commit ee4cbd1

Please sign in to comment.