Changing default bitrate

This commit is contained in:
Fabian Stamm 2021-12-05 00:05:45 +01:00
parent e3b8716a85
commit e887908a45

View File

@ -60,7 +60,7 @@ sf.streamURL_text = "Loading...";
let connectToId = new URL(window.location.href).searchParams.get("id");
let bitrate = new URL(window.location.href).searchParams.get("br") || 10000;
let bitrate = new URL(window.location.href).searchParams.get("br") || 50000;
if (connectToId) {
sf.streamURLCont_style = "display:none";
@ -81,15 +81,19 @@ function bitrateTransform(sdp) {
var arr = sdp.split("\r\n");
arr.forEach((str, i) => {
if (/^a=fmtp:\d*/.test(str)) {
console.log("found fmtp");
arr[i] =
str +
`;x-google-max-bitrate=${bitrate};x-google-min-bitrate=0;x-google-start-bitrate=6000`;
`;x-google-max-bitrate=${bitrate};x-google-min-bitrate=0;x-google-start-bitrate=12000`;
} else if (/^a=mid:(1|video)/.test(str)) {
console.log("found mid");
arr[i] += "\r\nb=AS:" + bitrate;
}
});
return arr.join("\r\n");
let res = arr.join("\r\n");
console.log(sdp, res);
return res;
}
peer.on("open", (id) => {