From de6344915059fa0f93a388f307323003bec094fa Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Mon, 21 Mar 2022 19:40:41 +0100 Subject: [PATCH] More paranoid match for Firefox bandwidth workaround. --- static/galene.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/static/galene.js b/static/galene.js index 0683a73..4f9988d 100644 --- a/static/galene.js +++ b/static/galene.js @@ -1220,8 +1220,20 @@ function setUpStream(c, stream) { }); // Firefox workaround + function match(a, b) { + if(!a || !b) + return false; + if(a.length !== b.length) + return false; + for(let i = 0; i < a.length; i++) { + if(a.maxBitrate !== b.maxBitrate) + return false; + } + return true; + } + let p = tr.sender.getParameters(); - if(!p.encodings || p.encodings.length != encodings.length) { + if(!p || !match(p.encodings, encodings)) { p.encodings = encodings; tr.sender.setParameters(p); }