mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
review
This commit is contained in:
@@ -137,7 +137,7 @@ export const createLocalMembership$ = ({
|
|||||||
matrixRoom,
|
matrixRoom,
|
||||||
trackProcessorState$,
|
trackProcessorState$,
|
||||||
widget,
|
widget,
|
||||||
logger,
|
logger: parentLogger,
|
||||||
}: Props): {
|
}: Props): {
|
||||||
// publisher: Publisher
|
// publisher: Publisher
|
||||||
requestConnect: () => LocalMemberConnectionState;
|
requestConnect: () => LocalMemberConnectionState;
|
||||||
@@ -163,8 +163,8 @@ export const createLocalMembership$ = ({
|
|||||||
/** @deprecated use state instead*/
|
/** @deprecated use state instead*/
|
||||||
configError$: Behavior<ElementCallError | null>;
|
configError$: Behavior<ElementCallError | null>;
|
||||||
} => {
|
} => {
|
||||||
const prefixLogger = logger.getChild("[LocalMembership]");
|
const logger = parentLogger.getChild("[LocalMembership]");
|
||||||
prefixLogger.debug(`Creating local membership..`);
|
logger.debug(`Creating local membership..`);
|
||||||
const state = {
|
const state = {
|
||||||
livekit$: new BehaviorSubject<LocalMemberLivekitState>({
|
livekit$: new BehaviorSubject<LocalMemberLivekitState>({
|
||||||
state: LivekitState.Uninitialized,
|
state: LivekitState.Uninitialized,
|
||||||
@@ -187,35 +187,23 @@ export const createLocalMembership$ = ({
|
|||||||
|
|
||||||
// Drop Epoch data here since we will not combine this anymore
|
// Drop Epoch data here since we will not combine this anymore
|
||||||
const localConnection$ = scope.behavior(
|
const localConnection$ = scope.behavior(
|
||||||
combineLatest([connectionManager.connections$, localTransport$])
|
combineLatest([connectionManager.connections$, localTransport$]).pipe(
|
||||||
.pipe(
|
map(([connections, localTransport]) => {
|
||||||
map(([connections, localTransport]) => {
|
if (localTransport === null) {
|
||||||
if (localTransport === null) {
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
return (
|
||||||
return (
|
connections.value.find((connection) =>
|
||||||
connections.value.find((connection) =>
|
areLivekitTransportsEqual(connection.transport, localTransport),
|
||||||
areLivekitTransportsEqual(connection.transport, localTransport),
|
) ?? null
|
||||||
) ?? null
|
);
|
||||||
);
|
}),
|
||||||
}),
|
tap((connection) => {
|
||||||
)
|
logger.info(
|
||||||
.pipe(
|
`Local connection updated: ${connection?.transport?.livekit_service_url}`,
|
||||||
distinctUntilChanged((a, b) => {
|
);
|
||||||
const eq = a === b;
|
}),
|
||||||
logger.debug(
|
),
|
||||||
`distinctUntilChanged: Local connection equality check: ${eq}`,
|
|
||||||
);
|
|
||||||
return eq;
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.pipe(
|
|
||||||
tap((connection) => {
|
|
||||||
prefixLogger.info(
|
|
||||||
`Local connection updated: ${connection?.transport?.livekit_service_url}`,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* Whether we are connected to the MatrixRTC session.
|
* Whether we are connected to the MatrixRTC session.
|
||||||
@@ -247,7 +235,7 @@ export const createLocalMembership$ = ({
|
|||||||
),
|
),
|
||||||
).pipe(
|
).pipe(
|
||||||
tap((connected) => {
|
tap((connected) => {
|
||||||
prefixLogger.info(`Homeserver connected update: ${connected}`);
|
logger.info(`Homeserver connected update: ${connected}`);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -563,6 +551,7 @@ interface EnterRTCSessionOptions {
|
|||||||
* @param rtcSession
|
* @param rtcSession
|
||||||
* @param transport
|
* @param transport
|
||||||
* @param options
|
* @param options
|
||||||
|
* @throws If the widget could not send ElementWidgetActions.JoinCall action.
|
||||||
*/
|
*/
|
||||||
async function enterRTCSession(
|
async function enterRTCSession(
|
||||||
rtcSession: MatrixRTCSession,
|
rtcSession: MatrixRTCSession,
|
||||||
@@ -607,11 +596,6 @@ async function enterRTCSession(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (widget) {
|
if (widget) {
|
||||||
// try {
|
|
||||||
await widget.api.transport.send(ElementWidgetActions.JoinCall, {});
|
await widget.api.transport.send(ElementWidgetActions.JoinCall, {});
|
||||||
// TODO Why catch and swallow?
|
|
||||||
// } catch (e) {
|
|
||||||
// logger.error("Failed to send join action", e);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,9 +68,6 @@ function setupTest(): void {
|
|||||||
}),
|
}),
|
||||||
getDeviceId: vi.fn().mockReturnValue("ABCDEF"),
|
getDeviceId: vi.fn().mockReturnValue("ABCDEF"),
|
||||||
} as unknown as OpenIDClientParts);
|
} as unknown as OpenIDClientParts);
|
||||||
// fakeMembershipsFocusMap$ = new BehaviorSubject<
|
|
||||||
// { membership: CallMembership; transport: LivekitTransport }[]
|
|
||||||
// >([]);
|
|
||||||
|
|
||||||
localParticipantEventEmiter = new EventEmitter();
|
localParticipantEventEmiter = new EventEmitter();
|
||||||
|
|
||||||
|
|||||||
@@ -117,9 +117,9 @@ export function createConnectionManager$({
|
|||||||
scope,
|
scope,
|
||||||
connectionFactory,
|
connectionFactory,
|
||||||
inputTransports$,
|
inputTransports$,
|
||||||
logger: _logger,
|
logger: parentLogger,
|
||||||
}: Props): IConnectionManager {
|
}: Props): IConnectionManager {
|
||||||
const logger = _logger.getChild("[ConnectionManager]");
|
const logger = parentLogger.getChild("[ConnectionManager]");
|
||||||
|
|
||||||
const running$ = new BehaviorSubject(true);
|
const running$ = new BehaviorSubject(true);
|
||||||
scope.onEnd(() => running$.next(false));
|
scope.onEnd(() => running$.next(false));
|
||||||
|
|||||||
Reference in New Issue
Block a user