Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function handleStartMediasoup(vCodecName) {
const worker = await Mediasoup.createWorker(CONFIG.mediasoup.worker);
global.mediasoup.worker = worker;
worker.on("died", () => {
console.error(
"mediasoup worker died, exit in 3 seconds... [pid:%d]",
worker.pid
);
setTimeout(() => process.exit(1), 3000);
});
console.log("mediasoup worker created [pid:%d]", worker.pid);
// Build a RouterOptions based on 'CONFIG.mediasoup.router' and the
// requested 'vCodecName'
const routerOptions = {
mediaCodecs: []
async function handleStartMediasoup() {
const worker = await Mediasoup.createWorker(CONFIG.mediasoup.worker);
global.mediasoup.worker = worker;
worker.on("died", () => {
console.error(
"mediasoup worker died, exit in 3 seconds... [pid:%d]",
worker.pid
);
setTimeout(() => process.exit(1), 3000);
});
console.log("mediasoup worker created [pid:%d]", worker.pid);
const router = await worker.createRouter(CONFIG.mediasoup.router);
global.mediasoup.router = router;
// At this point, the computed router.rtpCapabilities includes the
async function startMediasoup() {
let worker = await mediasoup.createWorker({
logLevel: config.mediasoup.worker.logLevel,
logTags: config.mediasoup.worker.logTags,
rtcMinPort: config.mediasoup.worker.rtcMinPort,
rtcMaxPort: config.mediasoup.worker.rtcMaxPort,
});
worker.on('died', () => {
console.error('mediasoup worker died (this should never happen)');
process.exit(1);
});
const mediaCodecs = config.mediasoup.router.mediaCodecs;
const router = await worker.createRouter({ mediaCodecs });
// audioLevelObserver for signaling active speaker
//
async function runMediasoupWorker() {
worker = await mediasoup.createWorker({
logLevel: config.mediasoup.worker.logLevel,
logTags: config.mediasoup.worker.logTags,
rtcMinPort: config.mediasoup.worker.rtcMinPort,
rtcMaxPort: config.mediasoup.worker.rtcMaxPort,
});
worker.on('died', () => {
console.error('mediasoup worker died, exiting in 2 seconds... [pid:%d]', worker.pid);
setTimeout(() => process.exit(1), 2000);
});
const mediaCodecs = config.mediasoup.router.mediaCodecs;
mediasoupRouter = await worker.createRouter({ mediaCodecs });
}
async function runMediasoupWorkers()
{
const { numWorkers } = config.mediasoup;
logger.info('running %d mediasoup Workers...', numWorkers);
for (let i = 0; i < numWorkers; ++i)
{
const worker = await mediasoup.createWorker(
{
logLevel : config.mediasoup.worker.logLevel,
logTags : config.mediasoup.worker.logTags,
rtcMinPort : config.mediasoup.worker.rtcMinPort,
rtcMaxPort : config.mediasoup.worker.rtcMaxPort
});
worker.on('died', () =>
{
logger.error(
'mediasoup Worker died, exiting in 2 seconds... [pid:%d]', worker.pid);
setTimeout(() => process.exit(1), 2000);
});
mediasoupWorkers.push(worker);