Merge pull request #20987 from bigbluebutton/sfu2141-msad

feat(audio): dedicate mediasoup workers for audio streams
This commit is contained in:
Paulo Lanzarin 2024-08-21 09:53:25 -03:00 committed by GitHub
commit 80e71d619e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,9 @@ case "$1" in
chown bigbluebutton:bigbluebutton $TARGET chown bigbluebutton:bigbluebutton $TARGET
# Set mediasoup IPs # Set mediasoup IPs
# mediasoup.webrtc.listenIps[]: used for EXTERNAL comms (browser <-> ms)
yq e -i ".mediasoup.webrtc.listenIps[0].announcedIp = \"$IP\"" $TARGET yq e -i ".mediasoup.webrtc.listenIps[0].announcedIp = \"$IP\"" $TARGET
# mediasoup.plainRtp.listenIp: used for INTERNAL comms (FreeSWITCH <-> ms)
yq e -i ".mediasoup.plainRtp.listenIp.announcedIp = \"$IP\"" $TARGET yq e -i ".mediasoup.plainRtp.listenIp.announcedIp = \"$IP\"" $TARGET
# mediasoup.workerBalancing: defines the strategy to distribute mediasoup # mediasoup.workerBalancing: defines the strategy to distribute mediasoup
# elements (transports, producers, consumers) among workers. # elements (transports, producers, consumers) among workers.
@ -18,6 +20,14 @@ case "$1" in
# mediasoup.enableWorkerTransposing: whether to enable worker transposing # mediasoup.enableWorkerTransposing: whether to enable worker transposing
# (ie: the ability to move a media stream from one worker to another). # (ie: the ability to move a media stream from one worker to another).
yq e -i '.mediasoup.enableWorkerTransposing = true' $TARGET yq e -i '.mediasoup.enableWorkerTransposing = true' $TARGET
# mediasoup.dedicatedMediaTypeWorkers.audio: spin up #auto mediasoup workers
# dedicated to handling audio streams.
# auto = ceil((min(nproc,32) * 0.8) + (max(0, nproc - 32) / 2))
# The goal here is to try and preserve quality for audio streams via:
# - reducing noise from video streams in these single threaded workers
# - giving the possibility to specify different scheduling priorities for audio workers
yq e -i '.mediasoup.dedicatedMediaTypeWorkers.audio = "auto"' $TARGET
FREESWITCH_IP=$(xmlstarlet sel -t -v '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "local_ip_v4=")]/@data' /opt/freeswitch/conf/vars.xml | sed 's/local_ip_v4=//g') FREESWITCH_IP=$(xmlstarlet sel -t -v '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "local_ip_v4=")]/@data' /opt/freeswitch/conf/vars.xml | sed 's/local_ip_v4=//g')
if [ "$FREESWITCH_IP" != "" ]; then if [ "$FREESWITCH_IP" != "" ]; then