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 { type ObservableScope } from "../../ObservableScope.ts";
|
||||||
import { Connection } from "./Connection.ts";
|
import { Connection } from "./Connection.ts";
|
||||||
import type {
|
|
||||||
ClientOpenIDParts,
|
|
||||||
SFUConfig,
|
|
||||||
} from "../../../livekit/openIDSFU.ts";
|
|
||||||
import type { MediaDevices } from "../../MediaDevices.ts";
|
import type { MediaDevices } from "../../MediaDevices.ts";
|
||||||
import type { Behavior } from "../../Behavior.ts";
|
import type { Behavior } from "../../Behavior.ts";
|
||||||
import type { ProcessorState } from "../../../livekit/TrackProcessorContext.tsx";
|
import type { ProcessorState } from "../../../livekit/TrackProcessorContext.tsx";
|
||||||
@@ -39,6 +35,11 @@ import {
|
|||||||
noiseSuppressionSetting,
|
noiseSuppressionSetting,
|
||||||
autoGainControlSetting,
|
autoGainControlSetting,
|
||||||
} from "../../../settings/settings.ts";
|
} 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
|
// TODO evaluate if this should be done like the Publisher Factory
|
||||||
export interface ConnectionFactory {
|
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.
|
* @param livekitRoomFactory - Optional factory function (for testing) to create LivekitRoom instances. If not provided, a default factory is used.
|
||||||
*/
|
*/
|
||||||
public constructor(
|
public constructor(
|
||||||
private client: ClientOpenIDParts,
|
private client: ClientGetTokenParts & ClientOpenIDParts,
|
||||||
private readonly roomId: string,
|
private readonly roomId: string,
|
||||||
private devices: MediaDevices,
|
private devices: MediaDevices,
|
||||||
private processorState$: Behavior<ProcessorState>,
|
private processorState$: Behavior<ProcessorState>,
|
||||||
|
|||||||
@@ -59,7 +59,12 @@ export class ConnectionManagerData {
|
|||||||
private getKey(transport: UnstableLivekitTransport): string {
|
private getKey(transport: UnstableLivekitTransport): string {
|
||||||
// This is enough as a key because the ConnectionManager is already scoped by room.
|
// 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}`.
|
// 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[] {
|
public getConnections(): Connection[] {
|
||||||
|
|||||||
@@ -171,7 +171,22 @@ export function areUnstableLivekitTransportsEqual<
|
|||||||
T extends UnstableLivekitTransport,
|
T extends UnstableLivekitTransport,
|
||||||
>(t1: T | null, t2: T | null): boolean {
|
>(t1: T | null, t2: T | null): boolean {
|
||||||
if (t1 && t2) {
|
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;
|
return !t1 && !t2;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user