1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-31 15:24:23 +03:00

Fix some MatrixCall leaks and use a shared AudioContext (#2484)

* Fix some MatrixCall leaks and use a shared AudioContext

These leaks, combined with the dozens of AudioContexts floating around in memory across different CallFeeds, could cause some really bad performance issues and audio crashes on Chrome.

* Fully release the AudioContext in CallFeed's dispose method

* Fix tests
This commit is contained in:
Robin
2022-07-01 11:58:00 -04:00
committed by GitHub
parent e7493fd417
commit f9672cf307
5 changed files with 108 additions and 21 deletions

View File

@ -59,6 +59,17 @@ const DUMMY_SDP = (
"a=ssrc:3619738545 cname:2RWtmqhXLdoF4sOi\r\n"
);
class MockMediaStreamAudioSourceNode {
connect() {}
}
class MockAudioContext {
constructor() {}
createAnalyser() { return {}; }
createMediaStreamSource() { return new MockMediaStreamAudioSourceNode(); }
close() {}
}
class MockRTCPeerConnection {
localDescription: RTCSessionDescription;
@ -162,6 +173,9 @@ describe('Call', function() {
// @ts-ignore Mock
global.document = {};
// @ts-ignore Mock
global.AudioContext = MockAudioContext;
client = new TestClient("@alice:foo", "somedevice", "token", undefined, {});
// We just stub out sendEvent: we're not interested in testing the client's
// event sending code here