Commit 148c49d2 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

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.
parent ba75bfeb
...@@ -855,11 +855,9 @@ async function setSendParameters(c, bps, simulcast) { ...@@ -855,11 +855,9 @@ async function setSendParameters(c, bps, simulcast) {
if(!s.track || s.track.kind !== 'video') if(!s.track || s.track.kind !== 'video')
continue; continue;
let p = s.getParameters(); let p = s.getParameters();
if(!p.encodings) if((!p.encodings ||
p.encodings = [{}]; !simulcast && p.encodings.length != 1) ||
if((!simulcast && p.encodings.length != 1) ||
(simulcast && p.encodings.length != 2)) { (simulcast && p.encodings.length != 2)) {
// change the simulcast envelope
await replaceUpStream(c); await replaceUpStream(c);
return; return;
} }
...@@ -1213,17 +1211,14 @@ function setUpStream(c, stream) { ...@@ -1213,17 +1211,14 @@ function setUpStream(c, stream) {
streams: [stream], streams: [stream],
sendEncodings: encodings, sendEncodings: encodings,
}); });
if(t.kind === 'video') {
let p = tr.sender.getParameters();
if(!p.encodings) {
// Firefox workaround // Firefox workaround
updateSettings({simulcast: 'off'}); let p = tr.sender.getParameters();
reflectSettings(); if(!p.encodings || p.encodings.length != encodings.length) {
p.encodings = [encodings[0]]; p.encodings = encodings;
tr.sender.setParameters(p); tr.sender.setParameters(p);
} }
} }
}
// c.stream might be different from stream if there's a filter // c.stream might be different from stream if there's a filter
c.stream.getTracks().forEach(addUpTrack); c.stream.getTracks().forEach(addUpTrack);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment