1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Merge pull request #1579 from matrix-org/dbkr/foxes_dont_like_to_be_held

Fix extra negotiate message in Firefox
This commit is contained in:
David Baker
2021-01-19 17:51:35 +00:00
committed by GitHub

View File

@@ -1084,8 +1084,21 @@ export class MatrixCall extends EventEmitter {
await this.peerConn.setRemoteDescription(description); await this.peerConn.setRemoteDescription(description);
if (description.type === 'offer') { if (description.type === 'offer') {
// First we sent the direction of the tranciever to what we'd like it to be,
// irresepective of whether the other side has us on hold - so just whether we
// want the call to be on hold or not. This is necessary because in a few lines,
// we'll adjust the direction and unless we do this too, we'll never come off hold.
for (const tranceiver of this.peerConn.getTransceivers()) {
tranceiver.direction = this.isRemoteOnHold() ? 'inactive' : 'sendrecv';
}
const localDescription = await this.peerConn.createAnswer(); const localDescription = await this.peerConn.createAnswer();
await this.peerConn.setLocalDescription(localDescription); await this.peerConn.setLocalDescription(localDescription);
// Now we've got our answer, set the direction to the outcome of the negotiation.
// We need to do this otherwise Firefox will notice that the direction is not the
// currentDirection and try to negotiate itself off hold again.
for (const tranceiver of this.peerConn.getTransceivers()) {
tranceiver.direction = tranceiver.currentDirection;
}
this.sendVoipEvent(EventType.CallNegotiate, { this.sendVoipEvent(EventType.CallNegotiate, {
description: this.peerConn.localDescription, description: this.peerConn.localDescription,