1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

Don't remove streams that still have tracks (#2104)

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.
This commit is contained in:
David Baker
2022-01-14 09:43:50 +00:00
committed by GitHub
parent 129fb7f10f
commit 16ca09eed8

View File

@@ -1717,7 +1717,12 @@ export class MatrixCall extends EventEmitter {
const stream = ev.streams[0];
this.pushRemoteFeed(stream);
stream.addEventListener("removetrack", () => this.deleteFeedByStream(stream));
stream.addEventListener("removetrack", () => {
if (stream.getTracks().length === 0) {
logger.info(`Stream ID ${stream.id} has no tracks remaining - removing`);
this.deleteFeedByStream(stream);
}
});
};
private onDataChannel = (ev: RTCDataChannelEvent): void => {