mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Compare commits
2 Commits
legacy-mem
...
toger5/mul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16c0214769 | ||
|
|
a2d609d7cb |
@@ -111,7 +111,7 @@
|
||||
"livekit-client": "^2.18.1",
|
||||
"lodash-es": "^4.17.21",
|
||||
"loglevel": "^1.9.1",
|
||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#toger5/address-for-transport",
|
||||
"matrix-widget-api": "^1.16.1",
|
||||
"node-stdlib-browser": "^1.3.1",
|
||||
"normalize.css": "^8.0.1",
|
||||
|
||||
19
pnpm-lock.yaml
generated
19
pnpm-lock.yaml
generated
@@ -234,8 +234,8 @@ importers:
|
||||
specifier: ^1.9.1
|
||||
version: 1.9.2
|
||||
matrix-js-sdk:
|
||||
specifier: github:matrix-org/matrix-js-sdk#develop
|
||||
version: https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8c95727b6278fe7942c20d0b9485f984dd0694b7
|
||||
specifier: github:matrix-org/matrix-js-sdk#toger5/address-for-transport
|
||||
version: https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8019fb027ab9c445d2e8e925e00268b93f4c85c1
|
||||
matrix-widget-api:
|
||||
specifier: ^1.16.1
|
||||
version: 1.17.0
|
||||
@@ -437,6 +437,9 @@ packages:
|
||||
resolution: {integrity: sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/runtime@8.0.0':
|
||||
resolution: {integrity: sha512-sL6cvO2IfkSu/iU+zs2S/w01B7A8V7suXSIKEN4hPFFdZoiPGxrj5pAG0lCaqLWiEIrjKzdznIWuaLcxPR53qw==}
|
||||
|
||||
'@babel/template@7.29.7':
|
||||
resolution: {integrity: sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
@@ -5502,9 +5505,9 @@ packages:
|
||||
matrix-events-sdk@0.0.1:
|
||||
resolution: {integrity: sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA==}
|
||||
|
||||
matrix-js-sdk@https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8c95727b6278fe7942c20d0b9485f984dd0694b7:
|
||||
resolution: {gitHosted: true, tarball: https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8c95727b6278fe7942c20d0b9485f984dd0694b7}
|
||||
version: 41.7.0
|
||||
matrix-js-sdk@https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8019fb027ab9c445d2e8e925e00268b93f4c85c1:
|
||||
resolution: {gitHosted: true, integrity: sha512-rbovn06zGbwe21Q/S0vym1zldqiAN+Bd4qW43TOJqBvnPuRGUhi5bKlJ8i2hm+wi5s/i2lvIRLwM9gT2HzoLPA==, tarball: https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8019fb027ab9c445d2e8e925e00268b93f4c85c1}
|
||||
version: 41.8.0
|
||||
engines: {node: '>=22.0.0'}
|
||||
|
||||
matrix-widget-api@1.17.0:
|
||||
@@ -7391,6 +7394,8 @@ snapshots:
|
||||
|
||||
'@babel/runtime@7.29.2': {}
|
||||
|
||||
'@babel/runtime@8.0.0': {}
|
||||
|
||||
'@babel/template@7.29.7':
|
||||
dependencies:
|
||||
'@babel/code-frame': 7.29.7
|
||||
@@ -12352,9 +12357,9 @@ snapshots:
|
||||
|
||||
matrix-events-sdk@0.0.1: {}
|
||||
|
||||
matrix-js-sdk@https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8c95727b6278fe7942c20d0b9485f984dd0694b7:
|
||||
matrix-js-sdk@https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8019fb027ab9c445d2e8e925e00268b93f4c85c1:
|
||||
dependencies:
|
||||
'@babel/runtime': 7.29.2
|
||||
'@babel/runtime': 8.0.0
|
||||
'@matrix-org/matrix-sdk-crypto-wasm': 18.3.1
|
||||
another-json: 0.2.0
|
||||
bs58: 6.0.0
|
||||
|
||||
@@ -4,6 +4,7 @@ allowBuilds:
|
||||
"@swc/core": true
|
||||
"core-js": true
|
||||
"esbuild": true
|
||||
"matrix-js-sdk@https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8019fb027ab9c445d2e8e925e00268b93f4c85c1": true
|
||||
"matrix-js-sdk@https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8c95727b6278fe7942c20d0b9485f984dd0694b7": true
|
||||
"protobufjs": true
|
||||
overrides:
|
||||
|
||||
@@ -170,7 +170,7 @@ export const createLocalMembership$ = ({
|
||||
logger: parentLogger,
|
||||
muteStates,
|
||||
matrixRTCSession,
|
||||
roomId: roomId,
|
||||
roomId,
|
||||
}: Props): {
|
||||
/**
|
||||
* This request to start audio and video tracks.
|
||||
|
||||
@@ -180,9 +180,28 @@ export const createLocalTransport$ = ({
|
||||
distinctUntilChanged(areLivekitTransportsEqual),
|
||||
);
|
||||
|
||||
let lockedTransportAddress: string | undefined = undefined;
|
||||
const preferredTransport$ = combineLatest([preferredConfig$, delayId$]).pipe(
|
||||
switchMap(async ([transport, delayId]) => {
|
||||
try {
|
||||
// We want to copy over the address from the first member on the same sfu.
|
||||
if (lockedTransportAddress === undefined) {
|
||||
const firstMemberOnSameSfu = memberships$.value.value.find(
|
||||
(m) =>
|
||||
m.transports[0].type === "livekit" &&
|
||||
m.transports[0].livekit_service_url ===
|
||||
transport.livekit_service_url,
|
||||
);
|
||||
const copiedFromMemberOnSameSfuAddress = (
|
||||
firstMemberOnSameSfu?.transports[0] as LivekitTransportConfig
|
||||
)?.address;
|
||||
const defaultAddress = roomId + ownMembershipIdentity.memberId;
|
||||
lockedTransportAddress = copiedFromMemberOnSameSfuAddress ?? defaultAddress;
|
||||
}
|
||||
transport.address = lockedTransportAddress;
|
||||
logger.info(
|
||||
`Update preferredTransport$ ${transport.livekit_service_url} ${transport.address} with delayId ${delayId}`,
|
||||
);
|
||||
return await doOpenIdAndJWTFromUrl(
|
||||
transport,
|
||||
forceJwtEndpoint,
|
||||
@@ -308,11 +327,12 @@ async function doOpenIdAndJWTFromUrl(
|
||||
OpenIDClientParts,
|
||||
delayId?: string,
|
||||
): Promise<LocalTransportWithSFUConfig> {
|
||||
const sfuAddress = transport.address ?? roomId;
|
||||
const sfuConfig = await getSFUConfigWithOpenID(
|
||||
client,
|
||||
membership,
|
||||
transport.livekit_service_url,
|
||||
roomId,
|
||||
sfuAddress,
|
||||
{
|
||||
forceJwtEndpoint: forceJwtEndpoint,
|
||||
delayEndpointBaseUrl: client.baseUrl,
|
||||
|
||||
@@ -138,7 +138,7 @@ export class Connection {
|
||||
|
||||
// TODO: can we just keep the ConnectionOpts object instead of spreading?
|
||||
private readonly client: OpenIDClientParts;
|
||||
private readonly roomId: string;
|
||||
private readonly sfuAddress: string;
|
||||
private readonly logger: Logger;
|
||||
private readonly ownMembershipIdentity: CallMembershipIdentityParts;
|
||||
private readonly existingSFUConfig?: SFUConfig;
|
||||
@@ -152,12 +152,12 @@ export class Connection {
|
||||
public constructor(opts: ConnectionOpts, logger: Logger) {
|
||||
this.ownMembershipIdentity = opts.ownMembershipIdentity;
|
||||
this.existingSFUConfig = opts.existingSFUConfig;
|
||||
this.roomId = opts.roomId;
|
||||
this.sfuAddress = opts.transport.address ?? opts.roomId;
|
||||
this.logger = logger.getChild(
|
||||
"[Connection " + opts.transport.livekit_service_url + "]",
|
||||
);
|
||||
this.logger.info(
|
||||
`constructor: ${opts.transport.livekit_service_url} roomId: ${this.roomId} withSfuConfig?: ${opts.existingSFUConfig ? JSON.stringify(opts.existingSFUConfig) : "undefined"}`,
|
||||
`constructor: ${opts.transport.livekit_service_url} sfuAddress: ${this.sfuAddress} withSfuConfig?: ${opts.existingSFUConfig ? JSON.stringify(opts.existingSFUConfig) : "undefined"}`,
|
||||
);
|
||||
const { transport, client, scope } = opts;
|
||||
|
||||
@@ -284,7 +284,7 @@ export class Connection {
|
||||
this.client,
|
||||
this.ownMembershipIdentity,
|
||||
this.transport.livekit_service_url,
|
||||
this.roomId,
|
||||
this.sfuAddress,
|
||||
// dont pass any custom opts for the subscribe only connections
|
||||
{},
|
||||
this.logger,
|
||||
|
||||
@@ -45,7 +45,9 @@ export class ConnectionManagerData {
|
||||
private getKey(transport: LivekitTransportConfig): 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 (
|
||||
transport.livekit_service_url +"|"+ (transport.address ?? "default_address")
|
||||
);
|
||||
}
|
||||
|
||||
public getConnections(): Connection[] {
|
||||
@@ -171,6 +173,7 @@ export function createConnectionManager$({
|
||||
keys: [
|
||||
transport.transport.livekit_service_url,
|
||||
transport.sfuConfig,
|
||||
transport.transport.address,
|
||||
],
|
||||
data: undefined,
|
||||
};
|
||||
@@ -179,18 +182,20 @@ export function createConnectionManager$({
|
||||
keys: [
|
||||
transport.livekit_service_url,
|
||||
undefined as SFUConfig | undefined,
|
||||
transport.address,
|
||||
],
|
||||
data: undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
(scope, _data$, serviceUrl, sfuConfig) => {
|
||||
(scope, _data$, serviceUrl, sfuConfig, address) => {
|
||||
const connection = connectionFactory.createConnection(
|
||||
scope,
|
||||
{
|
||||
type: "livekit",
|
||||
livekit_service_url: serviceUrl,
|
||||
address,
|
||||
},
|
||||
ownMembershipIdentity,
|
||||
logger,
|
||||
|
||||
@@ -157,7 +157,10 @@ export function areLivekitTransportsEqual<T extends LivekitTransportConfig>(
|
||||
t2: T | null,
|
||||
): boolean {
|
||||
if (t1 && t2) {
|
||||
return t1.livekit_service_url === t2.livekit_service_url;
|
||||
return (
|
||||
t1.livekit_service_url === t2.livekit_service_url &&
|
||||
t1.address === t2.address
|
||||
);
|
||||
}
|
||||
return !t1 && !t2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user