Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated DeviceInfo in webrtc/call.ts #4654

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/webrtc/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import {
import { CallFeed } from "./callFeed.ts";
import { MatrixClient } from "../client.ts";
import { EventEmitterEvents, TypedEventEmitter } from "../models/typed-event-emitter.ts";
import { DeviceInfo } from "../crypto/deviceinfo.ts";
import { GroupCallUnknownDeviceError } from "./groupCall.ts";
import { IScreensharingOpts } from "./mediaHandler.ts";
import { MatrixError } from "../http-api/index.ts";
Expand Down Expand Up @@ -426,7 +425,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
private callStartTime?: number;

private opponentDeviceId?: string;
private opponentDeviceInfo?: DeviceInfo;
private hasOpponentDeviceInfo?: boolean;
private opponentSessionId?: string;
public groupCallId?: string;

Expand Down Expand Up @@ -633,19 +632,16 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
// ourselves (for example if the client is a RoomWidgetClient)
if (!this.client.getCrypto()) {
// All we know is the device ID
this.opponentDeviceInfo = new DeviceInfo(this.opponentDeviceId);
this.hasOpponentDeviceInfo = true;
return;
}
const userId = this.invitee || this.getOpponentMember()?.userId;

if (!userId) throw new Error("Couldn't find opponent user ID to init crypto");

// Here we were calling `MatrixClient.crypto.deviceList.downloadKeys` which is not supported by the rust cryptography.
const deviceInfoMap = new Map();
this.opponentDeviceInfo = deviceInfoMap.get(userId)?.get(this.opponentDeviceId);
if (this.opponentDeviceInfo === undefined) {
throw new GroupCallUnknownDeviceError(userId);
}
this.hasOpponentDeviceInfo = false;
throw new GroupCallUnknownDeviceError(userId);
}

/**
Expand Down Expand Up @@ -2509,7 +2505,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap

const userId = this.invitee || this.getOpponentMember()!.userId;
if (this.client.getUseE2eForGroupCall()) {
if (!this.opponentDeviceInfo) {
if (!this.hasOpponentDeviceInfo) {
logger.warn(`Call ${this.callId} sendVoipEvent() failed: we do not have opponentDeviceInfo`);
return;
}
Expand Down
Loading