mirror of
https://github.com/ianramzy/decentralized-video-chat.git
synced 2024-11-17 07:39:21 +08:00
Testing bitrate/res downscaling on n>4
This commit is contained in:
parent
003fca0399
commit
f72d77494e
@ -225,6 +225,15 @@ var VideoChat = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Downscale send resolution and bitrate if num in room > 4
|
||||||
|
if (VideoChat.peerConnections.size > 3) {
|
||||||
|
for (var pc in VideoChat.peerConnections) {
|
||||||
|
downscaleStream(pc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
callback(uuid);
|
callback(uuid);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -500,9 +509,25 @@ function sendToAllDataChannels(message) {
|
|||||||
// End Fullscreen
|
// End Fullscreen
|
||||||
|
|
||||||
|
|
||||||
// Downscale own stream
|
// Downscale single stream
|
||||||
function downscaleStreams() {
|
async function downscaleStream(pc) {
|
||||||
// To be implemented
|
height = 480;
|
||||||
|
rate = 800000;
|
||||||
|
try {
|
||||||
|
do {
|
||||||
|
h = height;
|
||||||
|
r = rate;
|
||||||
|
const [sender] = pc.getSenders();
|
||||||
|
const ratio = sender.track.getSettings().height / height;
|
||||||
|
const params = sender.getParameters();
|
||||||
|
if (!params.encodings) params.encodings = [{}]; // Firefox workaround!
|
||||||
|
params.encodings[0].scaleResolutionDownBy = Math.max(ratio, 1);
|
||||||
|
params.encodings[0].maxBitrate = rate;
|
||||||
|
await sender.setParameters(params);
|
||||||
|
} while (h != height);
|
||||||
|
} catch (e) {
|
||||||
|
logIt(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mute microphone
|
// Mute microphone
|
||||||
|
Loading…
Reference in New Issue
Block a user