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

Make webrtc stats collection optional (#3307)

* stats: disable stats collection if interval zero

* stats: add groupcall property for stats interval

* stats: disable collecting webrtc stats by default

* add setup methode for group call stats

* suppress lint errors in test
This commit is contained in:
Enrico Schwendig
2023-04-27 08:56:58 +02:00
committed by GitHub
parent 8f701f43fb
commit 261bc81554
4 changed files with 115 additions and 11 deletions

View File

@ -68,7 +68,7 @@ describe("GroupCallStats", () => {
jest.useRealTimers();
});
it("starting processing as well without stats collectors", async () => {
it("starting processing stats as well without stats collectors", async () => {
// @ts-ignore
stats.processStats = jest.fn();
stats.start();
@ -77,6 +77,16 @@ describe("GroupCallStats", () => {
expect(stats.processStats).toHaveBeenCalled();
});
it("not starting processing stats if interval 0", async () => {
const statsDisabled = new GroupCallStats(GROUP_CALL_ID, LOCAL_USER_ID, 0);
// @ts-ignore
statsDisabled.processStats = jest.fn();
statsDisabled.start();
jest.advanceTimersByTime(TIME_INTERVAL);
// @ts-ignore
expect(statsDisabled.processStats).not.toHaveBeenCalled();
});
it("starting processing and calling the collectors", async () => {
stats.addStatsReportGatherer("CALL_ID", "USER_ID", mockRTCPeerConnection());
const collector = stats.getStatsReportGatherer("CALL_ID");