This commit is contained in:
Robin
2026-10-05 12:00:46 +02:00
parent 8a06976494
commit 4326455249
3 changed files with 11 additions and 12 deletions
-2
View File
@@ -568,8 +568,6 @@ export function createCallViewModel$(
// membership advertises `${userId}:${deviceId}` as its `membershipID` // membership advertises `${userId}:${deviceId}` as its `membershipID`
// instead, so a uuid there names a member no peer can resolve. // instead, so a uuid there names a member no peer can resolve.
memberId: memberId:
// TODO: Make this conditional on the transport instead
// or else avoid using it in key messages
matrixRTCMode === MatrixRTCMode.Matrix_2_0 matrixRTCMode === MatrixRTCMode.Matrix_2_0
? uuidv4() ? uuidv4()
: `${userId}:${deviceId}`, : `${userId}:${deviceId}`,
@@ -31,7 +31,7 @@ import {
isLocalTransport, isLocalTransport,
type LocalTransport, type LocalTransport,
} from "../localMember/LocalTransport.ts"; } from "../localMember/LocalTransport.ts";
import { type SFUConfig } from "../../../livekit/openIDSFU.ts"; import { type SFUConfig } from "../../../livekit/auth";
export class ConnectionManagerData { export class ConnectionManagerData {
private readonly store: Map< private readonly store: Map<
@@ -60,7 +60,9 @@ export interface RemoteMatrixLivekitMember extends MatrixLivekitMember {
interface Props { interface Props {
scope: ObservableScope; scope: ObservableScope;
membershipsWithTransport$: Behavior< membershipsWithTransport$: Behavior<
Epoch<{ membership: CallMembership; transport?: UnstableLivekitTransport }[]> Epoch<
{ membership: CallMembership; transport?: UnstableLivekitTransport }[]
>
>; >;
connectionManager: IConnectionManager; connectionManager: IConnectionManager;
localUser: { deviceId: string; userId: string }; localUser: { deviceId: string; userId: string };
@@ -111,8 +113,8 @@ export function createRemoteMatrixLivekitMembers$({
const participants = transport const participants = transport
? managerData.getParticipantsForTransport(transport) ? managerData.getParticipantsForTransport(transport)
: []; : [];
const matches = participants.filter( const matches = participants.filter((p) =>
(p) => p.identity == membership.rtcBackendIdentity, membership.backendIdentities.includes(p.identity),
); );
const participant = matches[0] ?? null; const participant = matches[0] ?? null;
const connection = transport const connection = transport
@@ -143,9 +145,9 @@ export function createRemoteMatrixLivekitMembers$({
// Log whether the member could be matched to a LiveKit participant, // Log whether the member could be matched to a LiveKit participant,
// since a tile shows "waiting for media" for as long as it cannot. // since a tile shows "waiting for media" for as long as it cannot.
participant$.pipe(scope.bind()).subscribe((p) => { participant$.pipe(scope.bind()).subscribe((p) => {
const url = data$.value.connection?.transport.livekit_service_url; const transport = data$.value.connection?.transport;
logger.info( logger.info(
`[RemoteMatrixLivekitMembers] ${rtcBackendIdentity}: LiveKit participant ${p ? `matched (${p.sid})` : "missing"} on ${url ?? "no connection"}`, `[RemoteMatrixLivekitMembers] ${rtcBackendIdentity}: LiveKit participant ${p ? `matched (${p.sid})` : "missing"} on ${transport ? JSON.stringify(transport) : "no connection"}`,
); );
}); });
// will only get called once per backend identity. // will only get called once per backend identity.
@@ -165,10 +167,9 @@ export function createRemoteMatrixLivekitMembers$({
// TODO add back in the callviewmodel pauseWhen(this.pretendToBeDisconnected$) // TODO add back in the callviewmodel pauseWhen(this.pretendToBeDisconnected$)
// TODO add this to the JS-SDK // TODO add this to the JS-SDK
export function areUnstableLivekitTransportsEqual<T extends UnstableLivekitTransport>( export function areUnstableLivekitTransportsEqual<
t1: T | null, T extends UnstableLivekitTransport,
t2: T | null, >(t1: T | null, t2: T | null): boolean {
): boolean {
if (t1 && t2) { if (t1 && t2) {
return t1.livekit_service_url === t2.livekit_service_url; return t1.livekit_service_url === t2.livekit_service_url;
} }