From 1ac5c9acbd64a5ce1acb930824c633b5ed8ddc27 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 8 Mar 2021 16:55:48 +0000 Subject: [PATCH] Stop streams if the call has ended When we get user media, don't forget to close the streams if the call's ended by the time we got media. --- src/webrtc/call.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index 725060d67..31e915cb1 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -825,8 +825,11 @@ export class MatrixCall extends EventEmitter { return; } if (this.callHasEnded()) { + this.stopAllMedia(); return; } + this.localAVStream = stream; + logger.info("Got local AV stream with id " + this.localAVStream.id); this.setState(CallState.CreateOffer); @@ -852,8 +855,6 @@ export class MatrixCall extends EventEmitter { } } - this.localAVStream = stream; - logger.info("Got local AV stream with id " + this.localAVStream.id); // why do we enable audio (and only audio) tracks here? -- matthew setTracksEnabled(stream.getAudioTracks(), true); this.peerConn = this.createPeerConnection();