fixed things who even knows what i did anymore
This commit is contained in:
parent
4fad1647a8
commit
07c7e2258e
4 changed files with 80 additions and 14 deletions
|
@ -36,6 +36,7 @@ interface StreamSettings {
|
||||||
fps: StreamFps;
|
fps: StreamFps;
|
||||||
audio: boolean;
|
audio: boolean;
|
||||||
audioSource?: string;
|
audioSource?: string;
|
||||||
|
contentHint?: string;
|
||||||
workaround?: boolean;
|
workaround?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ interface Source {
|
||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentSettings: StreamSettings | null = null;
|
export let currentSettings: StreamSettings | null = null;
|
||||||
|
|
||||||
addPatch({
|
addPatch({
|
||||||
patches: [
|
patches: [
|
||||||
|
@ -179,7 +180,7 @@ function StreamSettings({
|
||||||
deps: [source.id]
|
deps: [source.id]
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
// the source's name is not properly being displayed
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Forms.FormTitle>What you're streaming</Forms.FormTitle>
|
<Forms.FormTitle>What you're streaming</Forms.FormTitle>
|
||||||
|
@ -228,7 +229,39 @@ function StreamSettings({
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
<section>
|
||||||
|
<Forms.FormTitle>Content Type</Forms.FormTitle>
|
||||||
|
<div>
|
||||||
|
<div className="vcd-screen-picker-radios">
|
||||||
|
<label className="vcd-screen-picker-radio" data-checked={settings.contentHint === "motion"}>
|
||||||
|
<Text variant="text-sm/bold">Prefer Smoothness</Text>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="contenthint"
|
||||||
|
value="motion"
|
||||||
|
checked={settings.contentHint === "moiton"}
|
||||||
|
onChange={() => setSettings(s => ({ ...s, contentHint: "motion" }))}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label className="vcd-screen-picker-radio" data-checked={settings.contentHint === "detail"}>
|
||||||
|
<Text variant="text-sm/bold">Prefer Clarity</Text>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="contenthint"
|
||||||
|
value="detail"
|
||||||
|
checked={settings.contentHint === "detail"}
|
||||||
|
onChange={() => setSettings(s => ({ ...s, contentHint: "detail" }))}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div className="vcd-screen-picker-hint-description">
|
||||||
|
<p>
|
||||||
|
Choosing "Prefer Clarity" will significantly lower framerate in exchange for a clearer
|
||||||
|
image.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
{isWindows && (
|
{isWindows && (
|
||||||
<Switch
|
<Switch
|
||||||
value={settings.audio}
|
value={settings.audio}
|
||||||
|
@ -333,6 +366,7 @@ function ModalComponent({
|
||||||
const [settings, setSettings] = useState<StreamSettings>({
|
const [settings, setSettings] = useState<StreamSettings>({
|
||||||
resolution: "1080",
|
resolution: "1080",
|
||||||
fps: "60",
|
fps: "60",
|
||||||
|
contentHint: "motion",
|
||||||
audio: true
|
audio: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -361,22 +395,26 @@ function ModalComponent({
|
||||||
disabled={!selected}
|
disabled={!selected}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
currentSettings = settings;
|
currentSettings = settings;
|
||||||
|
|
||||||
// If there are 2 connections, the second one is the existing stream.
|
// If there are 2 connections, the second one is the existing stream.
|
||||||
// In that case, we patch its quality
|
// In that case, we patch its quality
|
||||||
const conn = [...MediaEngineStore.getMediaEngine().connections][1];
|
const conn = [...MediaEngineStore.getMediaEngine().connections][1];
|
||||||
if (conn && conn.videoStreamParameters.length > 0) {
|
if (conn && conn.videoStreamParameters.length > 0) {
|
||||||
|
const track = conn.input.stream.getVideoTracks()[0];
|
||||||
|
const frameRate = Number(settings.fps);
|
||||||
const height = Number(settings.resolution);
|
const height = Number(settings.resolution);
|
||||||
const width = Math.round(height * (16 / 9));
|
const width = Math.round(height * (16 / 9));
|
||||||
Object.assign(conn.videoStreamParameters[0], {
|
var constraints = track.getConstraints();
|
||||||
maxFrameRate: Number(settings.fps),
|
const newConstraints = {
|
||||||
maxPixelCount: width * height,
|
...constraints,
|
||||||
maxBitrate: 8000000,
|
frameRate,
|
||||||
maxResolution: {
|
width: { ideal: width },
|
||||||
type: "fixed",
|
height: { ideal: height },
|
||||||
width,
|
advanced: [{ width: width, height: height }]
|
||||||
height
|
};
|
||||||
}
|
|
||||||
|
track.applyConstraints(newConstraints).then(() => {
|
||||||
|
console.log("Applied constraints successfully");
|
||||||
|
console.log("New settings:", track.getSettings());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,3 +122,10 @@
|
||||||
.vcd-screen-picker-audio {
|
.vcd-screen-picker-audio {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vcd-screen-picker-hint-description {
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--interactive-active);
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
}
|
|
@ -7,6 +7,6 @@
|
||||||
// TODO: Possibly auto generate glob if we have more patches in the future
|
// TODO: Possibly auto generate glob if we have more patches in the future
|
||||||
import "./enableNotificationsByDefault";
|
import "./enableNotificationsByDefault";
|
||||||
import "./platformClass";
|
import "./platformClass";
|
||||||
import "./screenShareAudio";
|
import "./screenShareFixes";
|
||||||
import "./spellCheck";
|
import "./spellCheck";
|
||||||
import "./windowsTitleBar";
|
import "./windowsTitleBar";
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { currentSettings } from "renderer/components/ScreenSharePicker";
|
||||||
import { isLinux } from "renderer/utils";
|
import { isLinux } from "renderer/utils";
|
||||||
|
|
||||||
if (isLinux) {
|
if (isLinux) {
|
||||||
|
@ -23,6 +24,26 @@ if (isLinux) {
|
||||||
const stream = await original.call(this, opts);
|
const stream = await original.call(this, opts);
|
||||||
const id = await getVirtmic();
|
const id = await getVirtmic();
|
||||||
|
|
||||||
|
const frameRate = Number(currentSettings?.fps);
|
||||||
|
const height = Number(currentSettings?.resolution);
|
||||||
|
const width = Math.round(height * (16 / 9));
|
||||||
|
var track = stream.getVideoTracks()[0];
|
||||||
|
|
||||||
|
track.contentHint = String(currentSettings?.contentHint);
|
||||||
|
var constraints = track.getConstraints();
|
||||||
|
const newConstraints = {
|
||||||
|
...constraints,
|
||||||
|
frameRate,
|
||||||
|
width: { ideal: width },
|
||||||
|
height: { ideal: height },
|
||||||
|
advanced: [{ width: width, height: height }]
|
||||||
|
};
|
||||||
|
|
||||||
|
track.applyConstraints(newConstraints).then(() => {
|
||||||
|
console.log("Applied constraints successfully");
|
||||||
|
console.log("New settings:", track.getSettings());
|
||||||
|
});
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
const audio = await navigator.mediaDevices.getUserMedia({
|
const audio = await navigator.mediaDevices.getUserMedia({
|
||||||
audio: {
|
audio: {
|
Reference in a new issue