From 148c49d253c53a3dd2ae0a05aaa06516d2c605df Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sun, 20 Mar 2022 21:52:24 +0100 Subject: [PATCH] Enable simulcast on Firefox. Firefox uses a non-standard protocol for simulcast, which has been supported by Pion for a while now. Enable simulcast in Firefox. --- static/galene.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/static/galene.js b/static/galene.js index b6fef25..86c0882 100644 --- a/static/galene.js +++ b/static/galene.js @@ -855,11 +855,9 @@ async function setSendParameters(c, bps, simulcast) { if(!s.track || s.track.kind !== 'video') continue; let p = s.getParameters(); - if(!p.encodings) - p.encodings = [{}]; - if((!simulcast && p.encodings.length != 1) || + if((!p.encodings || + !simulcast && p.encodings.length != 1) || (simulcast && p.encodings.length != 2)) { - // change the simulcast envelope await replaceUpStream(c); return; } @@ -1213,15 +1211,12 @@ function setUpStream(c, stream) { streams: [stream], sendEncodings: encodings, }); - if(t.kind === 'video') { - let p = tr.sender.getParameters(); - if(!p.encodings) { - // Firefox workaround - updateSettings({simulcast: 'off'}); - reflectSettings(); - p.encodings = [encodings[0]]; - tr.sender.setParameters(p); - } + + // Firefox workaround + let p = tr.sender.getParameters(); + if(!p.encodings || p.encodings.length != encodings.length) { + p.encodings = encodings; + tr.sender.setParameters(p); } }