forked from hibas123/ScreenSharingThing
Changing default bitrate
This commit is contained in:
parent
e3b8716a85
commit
e887908a45
@ -60,7 +60,7 @@ sf.streamURL_text = "Loading...";
|
|||||||
|
|
||||||
let connectToId = new URL(window.location.href).searchParams.get("id");
|
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) {
|
if (connectToId) {
|
||||||
sf.streamURLCont_style = "display:none";
|
sf.streamURLCont_style = "display:none";
|
||||||
@ -81,15 +81,19 @@ function bitrateTransform(sdp) {
|
|||||||
var arr = sdp.split("\r\n");
|
var arr = sdp.split("\r\n");
|
||||||
arr.forEach((str, i) => {
|
arr.forEach((str, i) => {
|
||||||
if (/^a=fmtp:\d*/.test(str)) {
|
if (/^a=fmtp:\d*/.test(str)) {
|
||||||
|
console.log("found fmtp");
|
||||||
arr[i] =
|
arr[i] =
|
||||||
str +
|
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)) {
|
} else if (/^a=mid:(1|video)/.test(str)) {
|
||||||
|
console.log("found mid");
|
||||||
arr[i] += "\r\nb=AS:" + bitrate;
|
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) => {
|
peer.on("open", (id) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user