[mirotalksfu] - fix

هذا الالتزام موجود في:
Miroslav Pejic
2024-03-10 21:05:23 +01:00
الأصل 4c87a559df
التزام caf1fd6666

عرض الملف

@@ -200,10 +200,15 @@ const roomList = new Map(); // All Rooms
const presenters = {}; // collect presenters grp by roomId const presenters = {}; // collect presenters grp by roomId
let announcedAddress = config.mediasoup.webRtcTransport.listenInfos[0].announcedAddress; // announcedAddress (server public IPv4) const webRtcServerActive = config.mediasoup.webRtcServerActive;
// announcedAddress (server public IPv4)
let announcedAddress = webRtcServerActive
? config.mediasoup.webRtcServerOptions.listenInfos[0].announcedAddress
: config.mediasoup.webRtcTransport.listenInfos[0].announcedAddress;
// All mediasoup workers // All mediasoup workers
let workers = []; const workers = [];
let nextMediasoupWorkerIdx = 0; let nextMediasoupWorkerIdx = 0;
// Autodetect announcedAddress (https://www.ipify.org) // Autodetect announcedAddress (https://www.ipify.org)
@@ -217,9 +222,15 @@ if (!announcedAddress) {
(resp) => { (resp) => {
resp.on('data', (ip) => { resp.on('data', (ip) => {
announcedAddress = ip.toString(); announcedAddress = ip.toString();
config.mediasoup.webRtcTransport.listenInfos.forEach((info) => { if (webRtcServerActive) {
info.announcedAddress = announcedAddress; config.mediasoup.webRtcServerOptions.listenInfos.forEach((info) => {
}); info.announcedAddress = announcedAddress;
});
} else {
config.mediasoup.webRtcTransport.listenInfos.forEach((info) => {
info.announcedAddress = announcedAddress;
});
}
startServer(); startServer();
}); });
}, },
@@ -759,15 +770,19 @@ function startServer() {
rtcMaxPort: rtcMaxPort, rtcMaxPort: rtcMaxPort,
}); });
if (config.mediasoup.webRtcServerActive) { if (webRtcServerActive) {
//
log.info('Create a WebRtcServer', { worker_pid: worker.pid });
const webRtcServerOptions = clone(config.mediasoup.webRtcServerOptions); const webRtcServerOptions = clone(config.mediasoup.webRtcServerOptions);
const portIncrement = i; const portIncrement = i;
for (const listenInfo of webRtcServerOptions.listenInfos) { for (const listenInfo of webRtcServerOptions.listenInfos) {
listenInfo.port += portIncrement; listenInfo.port += portIncrement;
} }
//log.info('WebRtcServer options', { webRtcServerOptions: webRtcServerOptions });
log.info('Create a WebRtcServer', {
worker_pid: worker.pid,
webRtcServerOptions: webRtcServerOptions,
});
const webRtcServer = await worker.createWebRtcServer(webRtcServerOptions); const webRtcServer = await worker.createWebRtcServer(webRtcServerOptions);
worker.appData.webRtcServer = webRtcServer; worker.appData.webRtcServer = webRtcServer;
} }