From ca1eae12967c0665597e289d65d65a6b33bcabae Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 14 Mar 2023 10:44:39 +0000 Subject: [PATCH] Fix bug where video would not unmute if it started muted (#3213) Fixes https://github.com/vector-im/element-call/issues/925 --- spec/unit/webrtc/call.spec.ts | 25 +++++++++++++++++++++++++ src/webrtc/call.ts | 1 + 2 files changed, 26 insertions(+) diff --git a/spec/unit/webrtc/call.spec.ts b/spec/unit/webrtc/call.spec.ts index 6ec2dcb5d4d..51798d441af 100644 --- a/spec/unit/webrtc/call.spec.ts +++ b/spec/unit/webrtc/call.spec.ts @@ -431,6 +431,31 @@ describe("Call", function () { expect(transceivers.get("m.usermedia:video")!.sender.track!.id).toBe("usermedia_video_track"); }); + it("should unmute video after upgrading to video call", async () => { + // Regression test for https://github.com/vector-im/element-call/issues/925 + await startVoiceCall(client, call); + // start off with video muted + await call.setLocalVideoMuted(true); + + await call.onAnswerReceived( + makeMockEvent("@test:foo", { + version: 1, + call_id: call.callId, + party_id: "party_id", + answer: { + sdp: DUMMY_SDP, + }, + [SDPStreamMetadataKey]: {}, + }), + ); + + // then unmute which should cause an upgrade + await call.setLocalVideoMuted(false); + + // video should now be unmuted + expect(call.isLocalVideoMuted()).toBe(false); + }); + it("should handle SDPStreamMetadata changes", async () => { await startVoiceCall(client, call); diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index 3a719b40d0a..03c3536eb11 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -1400,6 +1400,7 @@ export class MatrixCall extends TypedEventEmitter