You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Refactor GroupCall participant management
This refactoring brings a number of improvements to GroupCall, which I've unfortunately had to combine into a single commit due to coupling: - Moves the expiration timestamp field on call membership state to be per-device - Makes the participants of a group call visible without having to enter the call yourself - Enables users to join group calls from multiple devices - Identifies active speakers by their call feed, rather than just their user ID - Plays nicely with clients that can be in multiple calls in a room at once - Fixes a memory leak caused by the call retry loop never stopping - Changes GroupCall to update its state synchronously, and write back to room state asynchronously - This was already sort of halfway being done, but now we'd be committing to it - Generally improves the robustness of the state machine - It means that group call joins will appear instant, in a sense For many reasons, this is a breaking change.
This commit is contained in:
13
src/utils.ts
13
src/utils.ts
@@ -694,3 +694,16 @@ export function sortEventsByLatestContentTimestamp(left: MatrixEvent, right: Mat
|
||||
export function isSupportedReceiptType(receiptType: string): boolean {
|
||||
return [ReceiptType.Read, ReceiptType.ReadPrivate].includes(receiptType as ReceiptType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether two maps are equal.
|
||||
* @param eq The equivalence relation to compare values by. Defaults to strict equality.
|
||||
*/
|
||||
export function mapsEqual<K, V>(x: Map<K, V>, y: Map<K, V>, eq = (v1: V, v2: V): boolean => v1 === v2): boolean {
|
||||
if (x.size !== y.size) return false;
|
||||
for (const [k, v1] of x) {
|
||||
const v2 = y.get(k);
|
||||
if (v2 === undefined || !eq(v1, v2)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user