impoved stream quality changing stability
This commit is contained in:
parent
11f9970f0c
commit
1d5000e619
1 changed files with 13 additions and 9 deletions
|
@ -54,7 +54,6 @@ interface Source {
|
||||||
export let currentSettings: StreamSettings | null = null;
|
export let currentSettings: StreamSettings | null = null;
|
||||||
|
|
||||||
const logger = new Vencord.Util.Logger("VesktopScreenShare");
|
const logger = new Vencord.Util.Logger("VesktopScreenShare");
|
||||||
var isOverloaded = false;
|
|
||||||
|
|
||||||
addPatch({
|
addPatch({
|
||||||
patches: [
|
patches: [
|
||||||
|
@ -453,19 +452,28 @@ function ModalComponent({
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
currentSettings = settings;
|
currentSettings = settings;
|
||||||
try {
|
try {
|
||||||
|
const frameRate = Number(settings.fps);
|
||||||
|
const height = Number(settings.resolution);
|
||||||
|
const width = Math.round(height * (16 / 9));
|
||||||
|
var conn = [...MediaEngineStore.getMediaEngine().connections].find(
|
||||||
|
connection => connection.streamUserId === UserStore.getCurrentUser().id
|
||||||
|
);
|
||||||
|
if (conn) {
|
||||||
|
conn.videoStreamParameters[0].maxFrameRate = frameRate;
|
||||||
|
conn.videoStreamParameters[0].maxResolution.height = height;
|
||||||
|
conn.videoStreamParameters[0].maxResolution.width = width;
|
||||||
|
}
|
||||||
submit({
|
submit({
|
||||||
id: selected!,
|
id: selected!,
|
||||||
...settings
|
...settings
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
var conn = [...MediaEngineStore.getMediaEngine().connections].find(
|
conn = [...MediaEngineStore.getMediaEngine().connections].find(
|
||||||
connection => connection.streamUserId === UserStore.getCurrentUser().id
|
connection => connection.streamUserId === UserStore.getCurrentUser().id
|
||||||
);
|
);
|
||||||
if (conn) {
|
if (conn) {
|
||||||
const track = conn.input.stream.getVideoTracks()[0];
|
const track = conn.input.stream.getVideoTracks()[0];
|
||||||
const frameRate = Number(settings.fps);
|
|
||||||
const height = Number(settings.resolution);
|
|
||||||
const width = Math.round(height * (16 / 9));
|
|
||||||
var constraints = track.getConstraints();
|
var constraints = track.getConstraints();
|
||||||
const newConstraints = {
|
const newConstraints = {
|
||||||
...constraints,
|
...constraints,
|
||||||
|
@ -481,10 +489,6 @@ function ModalComponent({
|
||||||
track.getConstraints()
|
track.getConstraints()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
conn.videoStreamParameters[0].maxFrameRate = frameRate;
|
|
||||||
conn.videoStreamParameters[0].maxResolution.height = height;
|
|
||||||
conn.videoStreamParameters[0].maxResolution.width = width;
|
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue