Skip to content

Commit f99d01f

Browse files
authored
Merge pull request #3512 from element-hq/voip-team/rebased-multiSFU
Multi-SFU media transport
2 parents e7e0fac + 301cf2f commit f99d01f

File tree

90 files changed

+4490
-4004
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+4490
-4004
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fail_ci_if_error: true
3131
playwright:
3232
name: Run end-to-end tests
33-
timeout-minutes: 30
33+
timeout-minutes: 60
3434
runs-on: ubuntu-latest
3535
steps:
3636
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4

backend/dev_homeserver.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ experimental_features:
3838
# MSC4222 needed for syncv2 state_after. This allow clients to
3939
# correctly track the state of the room.
4040
msc4222_enabled: true
41+
# sticky events for matrixRTC user state
42+
msc4354_enabled: true
4143

4244
# The maximum allowed duration by which sent events can be delayed, as
4345
# per MSC4140. Must be a positive value if set. Defaults to no

locales/en/app.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@
7272
"livekit_server_info": "LiveKit Server Info",
7373
"livekit_sfu": "LiveKit SFU: {{url}}",
7474
"matrix_id": "Matrix ID: {{id}}",
75+
"multi_sfu": "Multi-SFU media transport",
7576
"mute_all_audio": "Mute all audio (participants, reactions, join sounds)",
77+
"prefer_sticky_events": {
78+
"description": "Improves reliability of calls (requires homeserver support)",
79+
"label": "Prefer sticky events"
80+
},
7681
"show_connection_stats": "Show connection statistics",
77-
"show_non_member_tiles": "Show tiles for non-member media",
78-
"url_params": "URL parameters",
79-
"use_new_membership_manager": "Use the new implementation of the call MembershipManager",
80-
"use_to_device_key_transport": "Use to device key transport. This will fallback to room key transport when another call member sent a room key"
82+
"url_params": "URL parameters"
8183
},
8284
"disconnected_banner": "Connectivity to the server has been lost.",
8385
"error": {
@@ -92,7 +94,7 @@
9294
"generic_description": "Submitting debug logs will help us track down the problem.",
9395
"insufficient_capacity": "Insufficient capacity",
9496
"insufficient_capacity_description": "The server has reached its maximum capacity and you cannot join the call at this time. Try again later, or contact your server admin if the problem persists.",
95-
"matrix_rtc_focus_missing": "The server is not configured to work with {{brand}}. Please contact your server admin (Domain: {{domain}}, Error Code: {{ errorCode }}).",
97+
"matrix_rtc_transport_missing": "The server is not configured to work with {{brand}}. Please contact your server admin (Domain: {{domain}}, Error Code: {{ errorCode }}).",
9698
"open_elsewhere": "Opened in another tab",
9799
"open_elsewhere_description": "{{brand}} has been opened in another tab. If that doesn't sound right, try reloading the page.",
98100
"room_creation_restricted": "Failed to create call",

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"@opentelemetry/sdk-trace-base": "^2.0.0",
5555
"@opentelemetry/sdk-trace-web": "^2.0.0",
5656
"@opentelemetry/semantic-conventions": "^1.25.1",
57-
"@playwright/test": "^1.52.0",
57+
"@playwright/test": "^1.56.1",
5858
"@radix-ui/react-dialog": "^1.0.4",
5959
"@radix-ui/react-slider": "^1.1.2",
6060
"@radix-ui/react-visually-hidden": "^1.0.3",
@@ -99,6 +99,7 @@
9999
"eslint-plugin-react-hooks": "^5.0.0",
100100
"eslint-plugin-rxjs": "^5.0.3",
101101
"eslint-plugin-unicorn": "^56.0.0",
102+
"fetch-mock": "11.1.5",
102103
"global-jsdom": "^26.0.0",
103104
"i18next": "^24.0.0",
104105
"i18next-browser-languagedetector": "^8.0.0",
@@ -108,7 +109,7 @@
108109
"livekit-client": "^2.13.0",
109110
"lodash-es": "^4.17.21",
110111
"loglevel": "^1.9.1",
111-
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#head=develop",
112+
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#head=toger5/sticky-events&commit=e7f5bec51b6f70501a025b79fe5021c933385b21",
112113
"matrix-widget-api": "^1.13.0",
113114
"normalize.css": "^8.0.1",
114115
"observable-hooks": "^4.2.3",

src/MediaDevicesContext.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ export function useMediaDevices(): MediaDevices {
2323
return mediaDevices;
2424
}
2525

26-
export const useIsEarpiece = (): boolean => {
27-
const devices = useMediaDevices();
28-
const audioOutput = useObservableEagerState(devices.audioOutput.selected$);
29-
const available = useObservableEagerState(devices.audioOutput.available$);
30-
if (!audioOutput?.id) return false;
31-
return available.get(audioOutput.id)?.type === "earpiece";
32-
};
33-
3426
/**
3527
* A convenience hook to get the audio node configuration for the earpiece.
3628
* It will check the `useAsEarpiece` of the `audioOutput` device and return

src/RTCConnectionStats.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,26 @@ import mediaViewStyles from "../src/tile/MediaView.module.css";
1919
interface Props {
2020
audio?: RTCInboundRtpStreamStats | RTCOutboundRtpStreamStats;
2121
video?: RTCInboundRtpStreamStats | RTCOutboundRtpStreamStats;
22+
focusUrl?: string;
2223
}
2324

25+
const extractDomain = (url: string): string => {
26+
try {
27+
const parsedUrl = new URL(url);
28+
return parsedUrl.hostname; // Returns "kdk.cpm"
29+
} catch (error) {
30+
console.error("Invalid URL:", error);
31+
return url;
32+
}
33+
};
34+
2435
// This is only used in developer mode for debugging purposes, so we don't need full localization
25-
export const RTCConnectionStats: FC<Props> = ({ audio, video, ...rest }) => {
36+
export const RTCConnectionStats: FC<Props> = ({
37+
audio,
38+
video,
39+
focusUrl,
40+
...rest
41+
}) => {
2642
const [showModal, setShowModal] = useState(false);
2743
const [modalContents, setModalContents] = useState<
2844
"video" | "audio" | "none"
@@ -55,6 +71,13 @@ export const RTCConnectionStats: FC<Props> = ({ audio, video, ...rest }) => {
5571
</pre>
5672
</div>
5773
</Modal>
74+
{focusUrl && (
75+
<div>
76+
<Text as="span" size="xs" title="focusURL">
77+
&nbsp;{extractDomain(focusUrl)}
78+
</Text>
79+
</div>
80+
)}
5881
{audio && (
5982
<div>
6083
<Button

src/button/ReactionToggleButton.test.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ Please see LICENSE in the repository root for full details.
66
*/
77

88
import { act, render } from "@testing-library/react";
9-
import { expect, test } from "vitest";
9+
import { expect, test, vi } from "vitest";
1010
import { TooltipProvider } from "@vector-im/compound-web";
1111
import { userEvent } from "@testing-library/user-event";
1212
import { type ReactNode } from "react";
13-
import { type MatrixRTCSession } from "matrix-js-sdk/lib/matrixrtc";
1413

1514
import { ReactionToggleButton } from "./ReactionToggleButton";
1615
import { ElementCallReactionEventType } from "../reactions";
@@ -20,7 +19,9 @@ import { alice, local, localRtcMember } from "../utils/test-fixtures";
2019
import { type MockRTCSession } from "../utils/test";
2120
import { ReactionsSenderProvider } from "../reactions/useReactionsSender";
2221

23-
const localIdent = `${localRtcMember.sender}:${localRtcMember.deviceId}`;
22+
vi.mock("livekit-client/e2ee-worker?worker");
23+
24+
const localIdent = `${localRtcMember.userId}:${localRtcMember.deviceId}`;
2425

2526
function TestComponent({
2627
rtcSession,
@@ -33,7 +34,7 @@ function TestComponent({
3334
<TooltipProvider>
3435
<ReactionsSenderProvider
3536
vm={vm}
36-
rtcSession={rtcSession as unknown as MatrixRTCSession}
37+
rtcSession={rtcSession.asMockedSession()}
3738
>
3839
<ReactionToggleButton vm={vm} identifier={localIdent} />
3940
</ReactionsSenderProvider>

src/grid/GridLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { distinctUntilChanged } from "rxjs";
1515
import { useObservableEagerState } from "observable-hooks";
1616

17-
import { type GridLayout as GridLayoutModel } from "../state/CallViewModel";
17+
import { type GridLayout as GridLayoutModel } from "../state/layout-types.ts";
1818
import styles from "./GridLayout.module.css";
1919
import { useInitial } from "../useInitial";
2020
import { type CallLayout, arrangeTiles } from "./CallLayout";

src/grid/OneOnOneLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { type ReactNode, useCallback, useMemo } from "react";
99
import { useObservableEagerState } from "observable-hooks";
1010
import classNames from "classnames";
1111

12-
import { type OneOnOneLayout as OneOnOneLayoutModel } from "../state/CallViewModel";
12+
import { type OneOnOneLayout as OneOnOneLayoutModel } from "../state/layout-types.ts";
1313
import { type CallLayout, arrangeTiles } from "./CallLayout";
1414
import styles from "./OneOnOneLayout.module.css";
1515
import { type DragCallback, useUpdateLayout } from "./Grid";

src/grid/SpotlightExpandedLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details.
77

88
import { type ReactNode, useCallback } from "react";
99

10-
import { type SpotlightExpandedLayout as SpotlightExpandedLayoutModel } from "../state/CallViewModel";
10+
import { type SpotlightExpandedLayout as SpotlightExpandedLayoutModel } from "../state/layout-types.ts";
1111
import { type CallLayout } from "./CallLayout";
1212
import { type DragCallback, useUpdateLayout } from "./Grid";
1313
import styles from "./SpotlightExpandedLayout.module.css";

0 commit comments

Comments
 (0)