mirror of
https://github.com/vector-im/element-call.git
synced 2026-10-16 23:45:50 +00:00
WIP
This commit is contained in:
@@ -20,10 +20,6 @@ import { type UnstableLivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
|
||||
|
||||
import { type ObservableScope } from "../../ObservableScope.ts";
|
||||
import { Connection } from "./Connection.ts";
|
||||
import type {
|
||||
ClientOpenIDParts,
|
||||
SFUConfig,
|
||||
} from "../../../livekit/openIDSFU.ts";
|
||||
import type { MediaDevices } from "../../MediaDevices.ts";
|
||||
import type { Behavior } from "../../Behavior.ts";
|
||||
import type { ProcessorState } from "../../../livekit/TrackProcessorContext.tsx";
|
||||
@@ -39,6 +35,11 @@ import {
|
||||
noiseSuppressionSetting,
|
||||
autoGainControlSetting,
|
||||
} from "../../../settings/settings.ts";
|
||||
import {
|
||||
type ClientGetTokenParts,
|
||||
type ClientOpenIDParts,
|
||||
type SFUConfig,
|
||||
} from "../../../livekit/auth";
|
||||
|
||||
// TODO evaluate if this should be done like the Publisher Factory
|
||||
export interface ConnectionFactory {
|
||||
@@ -66,7 +67,7 @@ export class ECConnectionFactory implements ConnectionFactory {
|
||||
* @param livekitRoomFactory - Optional factory function (for testing) to create LivekitRoom instances. If not provided, a default factory is used.
|
||||
*/
|
||||
public constructor(
|
||||
private client: ClientOpenIDParts,
|
||||
private client: ClientGetTokenParts & ClientOpenIDParts,
|
||||
private readonly roomId: string,
|
||||
private devices: MediaDevices,
|
||||
private processorState$: Behavior<ProcessorState>,
|
||||
|
||||
@@ -59,7 +59,12 @@ export class ConnectionManagerData {
|
||||
private getKey(transport: UnstableLivekitTransport): string {
|
||||
// This is enough as a key because the ConnectionManager is already scoped by room.
|
||||
// We also do not need to consider the slotId at this point since each `MatrixRTCSession` is already scoped by `slotDescription: {id, application}`.
|
||||
return transport.livekit_service_url;
|
||||
return JSON.stringify([
|
||||
"url" in transport ? transport.url : undefined,
|
||||
"livekit_service_url" in transport
|
||||
? transport.livekit_service_url
|
||||
: undefined,
|
||||
]);
|
||||
}
|
||||
|
||||
public getConnections(): Connection[] {
|
||||
|
||||
@@ -171,7 +171,22 @@ export function areUnstableLivekitTransportsEqual<
|
||||
T extends UnstableLivekitTransport,
|
||||
>(t1: T | null, t2: T | null): boolean {
|
||||
if (t1 && t2) {
|
||||
return t1.livekit_service_url === t2.livekit_service_url;
|
||||
if ("url" in t1 !== "url" in t2) return false;
|
||||
if ("livekit_service_url" in t1 !== "livekit_service_url" in t2)
|
||||
return false;
|
||||
if (
|
||||
"url" in t1 &&
|
||||
t1.url !== (t2 as UnstableLivekitTransport & { url: string }).url
|
||||
)
|
||||
return false;
|
||||
if (
|
||||
"livekit_service_url" in t1 &&
|
||||
t1.livekit_service_url !==
|
||||
(t2 as UnstableLivekitTransport & { livekit_service_url: string })
|
||||
.livekit_service_url
|
||||
)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return !t1 && !t2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user