fix(media): close the UDP candidate migration boundary

This commit is contained in:
AAA committed 2026-08-19 21:08:49 +08:00
1 parent aadcba4e3b
commit 41ccbef68a
29 files changed
+548 -373

No files matched your search

+43 -12
View File
@@ -11,6 +11,10 @@ import {
type ScreenerServer,
} from "../src/server/app";
import { loadConfig } from "../src/server/config";
import {
RoomStore,
type RoomStoreOptions,
} from "../src/server/room-store";
import {
QUALITY_PROFILES,
QUALITY_RESOLUTIONS,
@@ -23,6 +27,21 @@ const PROFILE_SETTINGS = QUALITY_PROFILES;
type ProfileId = QualityProfileId;
type PageRole = "host" | "viewer";
class BenchmarkRoomStore extends RoomStore {
constructor(
options: RoomStoreOptions,
private readonly exactPeerRooms: Set<string>,
) {
super(options);
}
override createRoom() {
const room = super.createRoom();
this.exactPeerRooms.add(room.roomId);
return room;
}
}
export interface BenchmarkConfig {
chromePath: string;
viewerCounts: number[];
@@ -1935,19 +1954,31 @@ export async function main(): Promise<number> {
const debugPort = await reservePort();
const baseUrl = `http://127.0.0.1:${appPort}`;
profileDirectory = await mkdtemp(join(tmpdir(), "screener-peer-benchmark-"));
const exactPeerRooms = new Set(["1"]);
const serverConfig = loadConfig({
NODE_ENV: "development",
PORT: String(appPort),
LISTEN_HOST: "127.0.0.1",
PUBLIC_BASE_URL: baseUrl,
ALLOWED_ORIGINS: baseUrl,
ACCESS_PASSWORD: "",
ROOM_DATABASE_PATH: "",
PEER_ASSISTED_MEDIA: "true",
PEER_ASSISTED_ROOM_IDS: "1",
MAX_VIEWERS_PER_ROOM: String(Math.max(...config.viewerCounts)),
STUN_URLS: "",
});
serverConfig.peerAssistedRoomIds = exactPeerRooms;
server = await createScreenerServer({
config: loadConfig({
NODE_ENV: "development",
PORT: String(appPort),
LISTEN_HOST: "127.0.0.1",
PUBLIC_BASE_URL: baseUrl,
ALLOWED_ORIGINS: baseUrl,
ACCESS_PASSWORD: "",
ROOM_DATABASE_PATH: "",
PEER_ASSISTED_MEDIA: "true",
MAX_VIEWERS_PER_ROOM: String(Math.max(...config.viewerCounts)),
STUN_URLS: "",
}),
config: serverConfig,
roomStore: new BenchmarkRoomStore(
{
ttlMs: serverConfig.roomTtlMs,
maxRooms: serverConfig.maxRooms,
maxViewersPerRoom: serverConfig.maxViewersPerRoom,
},
exactPeerRooms,
),
});
await server.listen(appPort, "127.0.0.1");