diff --git a/src/main/index.ts b/src/main/index.ts index 9d6a52cc..325d4172 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -27,14 +27,18 @@ process.env.VENCORD_USER_DATA_DIR = DATA_DIR; function init() { const { disableSmoothScroll, hardwareAcceleration } = Settings.store; - if (hardwareAcceleration === false) app.disableHardwareAcceleration(); + if (hardwareAcceleration === false) { + app.disableHardwareAcceleration(); + } else { + app.commandLine.appendSwitch("enable-features", "VaapiVideoDecodeLinuxGL,VaapiVideoEncoder,VaapiVideoDecoder"); + } + if (disableSmoothScroll) { app.commandLine.appendSwitch("disable-smooth-scrolling"); } // work around chrome 66 disabling autoplay by default app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required"); - // WinRetrieveSuggestionsOnlyOnDemand: Work around electron 13 bug w/ async spellchecking on Windows. // HardwareMediaKeyHandling,MediaSessionService: Prevent Discord from registering as a media service. // diff --git a/src/renderer/components/ScreenSharePicker.tsx b/src/renderer/components/ScreenSharePicker.tsx index eddfd7af..cc0964cc 100644 --- a/src/renderer/components/ScreenSharePicker.tsx +++ b/src/renderer/components/ScreenSharePicker.tsx @@ -6,7 +6,7 @@ import "./screenSharePicker.css"; -import { closeModal, Margins, Modals, ModalSize, openModal, useAwaiter } from "@vencord/types/utils"; +import { closeModal, Logger, Margins, Modals, ModalSize, openModal, useAwaiter } from "@vencord/types/utils"; import { findStoreLazy, onceReady } from "@vencord/types/webpack"; import { Button, @@ -36,6 +36,7 @@ interface StreamSettings { fps: StreamFps; audio: boolean; audioSource?: string; + contentHint?: string; workaround?: boolean; onlyDefaultSpeakers?: boolean; } @@ -50,7 +51,9 @@ interface Source { url: string; } -let currentSettings: StreamSettings | null = null; +export let currentSettings: StreamSettings | null = null; + +const logger = new Logger("VesktopScreenShare"); addPatch({ patches: [ @@ -60,6 +63,20 @@ addPatch({ match: /this.localWant=/, replace: "$self.patchStreamQuality(this);$&" } + }, + { + find: "x-google-max-bitrate", + replacement: [ + { + // eslint-disable-next-line no-useless-escape + match: /"x-google-max-bitrate=".concat\(\i\)/, + replace: '"x-google-max-bitrate=".concat("80_000")' + }, + { + match: /;level-asymmetry-allowed=1/, + replace: ";b=AS:800000;level-asymmetry-allowed=1" + } + ] } ], patchStreamQuality(opts: any) { @@ -74,6 +91,14 @@ addPatch({ bitrateMax: 8000000, bitrateTarget: 600000 }); + if (opts?.encode) { + Object.assign(opts.encode, { + framerate, + width, + height, + pixelCount: height * width + }); + } Object.assign(opts.capture, { framerate, width, @@ -219,6 +244,47 @@ function StreamSettings({ +
+
+ Content Type +
+
+ + +
+
+

+ Choosing "Prefer Clarity" will result in a significantly lower framerate in + exchange for a much sharper and clearer image. +

+
+
+
+
@@ -358,6 +424,7 @@ function ModalComponent({ const [settings, setSettings] = useState({ resolution: "1080", fps: "60", + contentHint: "motion", audio: true }); @@ -367,7 +434,6 @@ function ModalComponent({ ScreenShare - {!selected ? ( @@ -380,35 +446,62 @@ function ModalComponent({ /> )} -