2024-05-07 21:17:42 -04:00
|
|
|
/*
|
|
|
|
|
* Vencord, a Discord client mod
|
|
|
|
|
* Copyright (c) 2024 Vendicated and contributors
|
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
2026-01-08 15:54:40 +01:00
|
|
|
import { definePluginSettings } from "@api/Settings";
|
2024-05-07 21:17:42 -04:00
|
|
|
import { Devs } from "@utils/constants";
|
2026-01-08 15:54:40 +01:00
|
|
|
import definePlugin, { OptionType } from "@utils/types";
|
|
|
|
|
|
|
|
|
|
const settings = definePluginSettings({
|
|
|
|
|
experimentalAV1Support: {
|
|
|
|
|
type: OptionType.BOOLEAN,
|
|
|
|
|
description: "Enable AV1 codec support. May cause issues like infinitely loading streams",
|
|
|
|
|
default: false
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-05-07 21:17:42 -04:00
|
|
|
|
|
|
|
|
export default definePlugin({
|
|
|
|
|
name: "WebScreenShareFixes",
|
|
|
|
|
authors: [Devs.Kaitlyn],
|
|
|
|
|
description: "Removes 2500kbps bitrate cap on chromium and vesktop clients.",
|
|
|
|
|
enabledByDefault: true,
|
2026-01-08 15:54:40 +01:00
|
|
|
settings,
|
|
|
|
|
|
2024-05-07 21:17:42 -04:00
|
|
|
patches: [
|
|
|
|
|
{
|
|
|
|
|
find: "x-google-max-bitrate",
|
|
|
|
|
replacement: [
|
|
|
|
|
{
|
|
|
|
|
match: /"x-google-max-bitrate=".concat\(\i\)/,
|
|
|
|
|
replace: '"x-google-max-bitrate=".concat("80_000")'
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-05-20 01:43:42 +02:00
|
|
|
match: ";level-asymmetry-allowed=1",
|
2024-05-07 21:17:42 -04:00
|
|
|
replace: ";b=AS:800000;level-asymmetry-allowed=1"
|
2025-05-20 01:43:42 +02:00
|
|
|
},
|
|
|
|
|
{
|
2025-06-08 11:47:59 -04:00
|
|
|
match: /;usedtx=".concat\((\i)\?"0":"1"\)/,
|
|
|
|
|
replace: '$&.concat($1?";stereo=1;sprop-stereo=1":"")'
|
2025-12-27 18:34:23 +01:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
match: /\i\?\[(\i\.\i)\.H265,\i\.\i\.H264,\i\.\i\.VP8,\i\.\i\.VP9\]/,
|
2026-01-08 15:54:40 +01:00
|
|
|
replace: "true?$self.getCodecs($1)"
|
2024-05-07 21:17:42 -04:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2026-01-08 15:54:40 +01:00
|
|
|
],
|
|
|
|
|
|
|
|
|
|
getCodecs(Codecs: Record<string, string>) {
|
|
|
|
|
const codecs = [Codecs.H265, Codecs.VP9, Codecs.H264, Codecs.VP8];
|
|
|
|
|
|
|
|
|
|
if (settings.store.experimentalAV1Support) {
|
|
|
|
|
codecs.unshift("AV1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return codecs;
|
|
|
|
|
}
|
2024-05-07 21:17:42 -04:00
|
|
|
});
|