#๐Ÿ–ฅ-vesktop-development

1 messages ยท Page 3 of 1

azure verge
#

maybe contentHint would do something

simple groveBOT
azure verge
#

i want to set it to motion but im struggling a bit

#

this didnt work

simple groveBOT
#

I found that for some reason, framerate takes directly from mediaDevices.getDisplayMedia (which returns MediaStream) object.
For fixing FPS value, we can just reapply constraints for the stream in src/renderer/patches/screenShareAudio.ts, where we already have getDisplayMedia function overriding:

navigator.mediaDevices.getDisplayMedia = async function (opts) {
        const stream = await original.call(this, opts);
     ...
vernal lintel
simple groveBOT
azure verge
#

that is amazing

#

i will get to testing that

#

well

#

it works for framerate

#

resolution is still

#

not applying

#

OH

#

NVM

#

IT APPLIES ON WINDOW CHANGE

#

oh but you lose the higher framerate....

#

odd

#

hmm

#

i dont like that though

#

ill have to keep testing

azure verge
#

well

#

progress has been made

#

resolution is mostly selectable

#

if you choose 1080p for some reason it picks your monitor resolution

#

and i cant get it to use higher than 30fps yet

#

but this is progress

azure verge
#

odd

#

it gets the correct res applied

#

and then instantly unapplies it

simple groveBOT
#

I wonder if discord has some kind of limit for framerates in the browser. It seems like its capped at 30 fps, no matter what you change.

I've been able to raise the framerate above 30, but that's going to take a lot more work before its at a point where resolution and framerate selections are functioning properly.

Ah I see, I have tried multiple things and never got it to anything above 30 but at the same time I am quite a big noob with discords api

azure verge
#

okay i take break for today

#

lets see if ithink of something crazy to fix this tmrw

simple groveBOT
simple groveBOT
simple groveBOT
simple groveBOT
simple groveBOT
simple groveBOT
simple groveBOT
simple groveBOT
simple groveBOT
simple groveBOT
simple groveBOT
vernal lintel
#

does chrome support av1 encoding

simple groveBOT
vernal lintel
#

how did ur pr get so many upvotes and hearts

#

like i know it's a long awaited change but how did so many people find it

simple groveBOT
sudden trout
vernal lintel
#

oh

sudden trout
vernal lintel
#

oh wow

#

the description is a bit misleading because it implies that the discord app also suffers from these fps issues

#

while it does suffer from many issues but not this one

azure verge
#

lkao

#

lmao*

#

plus idk
discord has support for it so
if they wanted they could write a shit ton of stuff to support it

vernal lintel
#

it's not that easy ๐Ÿ˜ญ

vernal lintel
#

u likely need to fork electron for that

azure verge
azure verge
simple groveBOT
simple groveBOT
#

Is your feature request related to a problem? Please describe.
Depends on what someone sees as a problem. For me it resides on this problem, that I use discord on my second screen half of the window and my input bar looks like this:
image
I personally only need the Timestamp and Translation. I never click on the Smiley/Gif/Sticker buttons and use their shortcuts.

**Describe the solution you'd ...

azure verge
#

webrtc supports it

#

and it's far better size-wise than h264

#

so less bitrate throttling

simple groveBOT
simple groveBOT
#
#
#
#

Also, i have another idea how to probably increase stability of stream. If we somehow will get RTCRtpSender object of stream then we can set degradationPreference property to "maintain-framerate", and it maybe will fix problem with fps drops on low bandwidth instead of decreasing video quality (just like default discord streams?)

#

Also, i have another idea how to probably increase stability of stream. If we somehow will get RTCRtpSender object of stream then we can set degradationPreference property to "maintain-framerate", and it maybe will fix problem with fps drops on low bandwidth instead of decreasing video quality (just like default discord streams?)

I think this is a good idea. I tried applying this myself, bu...

#

Also, i have another idea how to probably increase stability of stream. If we somehow will get RTCRtpSender object of stream then we can set degradationPreference property to "maintain-framerate", and it maybe will fix problem with fps drops on low bandwidth instead of decreasing video quality (just like default discord streams?)

I think this is a good idea. I tried applying this myself, bu...

#

Also, i have another idea how to probably increase stability of stream. If we somehow will get RTCRtpSender object of stream then we can set degradationPreference property to "maintain-framerate", and it maybe will fix problem with fps drops on low bandwidth instead of decreasing video quality (just like default discord streams?)

this is deprecated, I am not 100% sure but I believe you're...

simple groveBOT
simple groveBOT
azure verge
#

@vernal lintel so we've found out that now you can stream lowish res with 60fps(it automatically lowers the resolution to handle smooth 60fps) without nitro because all that nitro does is limit bandwidth and disable the button

#

should i add some sort of nitro check to keep us from

#

essentially modding in new functionality

vernal lintel
azure verge
#

yeah as far as we can see the bitrate is lower so its harder but you can still reach 60fps at resolutions like 480p or 720p

vernal lintel
#

interesting

azure verge
#

which isnt standard functionality

#

i worry about discord stepping in

vernal lintel
#

usually non nitro is stuck at 720p 30fps right

azure verge
#

yeah

vernal lintel
#

id say no don't limit it but set defaults to 720p30 if you don't have nitro and add a warning card that it might not be good quality if non nitro selects higher

#

i wonder if this also affects FakeNitro discord desktop

azure verge
#

I can do that

#

and

#

hmm

#

im not sure

vernal lintel
#

so why are you limited at 4kbps?

#

you have nitro

azure verge
#

i dont know

vernal lintel
#

is it only in the 10$ nitro

azure verge
#

oooh wait

#

lemme check that

azure verge
simple groveBOT
azure verge
#

in boosted servers it unlocks to 8000kbps

vernal lintel
#

oh interesting

azure verge
#

i havent been able to debug that fully

vernal lintel
#

discord probably has a function to get max bitrate

#

could check that and if it's only 4k show a warning if you select 1080p60

azure verge
#

should i add that into the todo as something to do/attempt to do before merging

vernal lintel
#

sure

#

i can also help with that

azure verge
#

alright

#

oh nice

simple groveBOT
real glade
#

premium tier (boosts) might

#

i can try to look into that

#

ok so boosts affect the highest bitrate you can set on a channel but that's supposed to be for voice only
higher boost levels do unlock higher quality but so does nitro, so there can't be a check there

#

hmmm

#

i wonder if video_quality_mode has any effect on this

real glade
#

i'm really doubting this has anything to do with nitro

#

interestingly the desktop client likes to target ~4800 too

simple groveBOT
real glade
#

this exp is interesting too

azure verge
#

lmk

#

it locks to like

#

exactly 4695ish

real glade
#

this happens on web too?

#

like on non-linux

azure verge
real glade
#

ah right

azure verge
#

because its really all that's major before merging this

#

the rest is small stuff that i dont know how easy it will be to fix and i dont want to make streaming take months to implement because of small bugs

azure verge
#

@vernal lintel i have a theory that some of the arbitrary bitrate limits on nitro users may come from the app being registered as a web client

#

is there a known way to spoof that

vernal lintel
#

yes but it makes discord think you're capable of their native vc stuff and thus breaks vc entirely

azure verge
#

damn

#

wait

#

what native vc stuff

#

just a shit ton of stuff from discord_voice?

vernal lintel
#

discord web uses WebRTC for vc

discord desktop uses a custom udp stack implemented via discord_voice

#

i don't know any details about it, it's proprietary and i don't really care about it

but web can't use that

azure verge
#

oh my fucking god

#

yeah that's dumb as hell

vernal lintel
#

if you spoof yourself as desktop, it expects you to be able to use their custom stuff and it entirely breaks vc

#

you can try it yourself

find where vesktop spoofs its user agent, it's somewhere in mainWindow.ts, and comment that line out

#

it will make it use the default electron user agent and make it think you're desktop

azure verge
#

good to know

#

thankies

#

yep

#

stuck on checking route

simple groveBOT
#

A bit unrelated but when testing this PR I found an issue when streaming Monster Hunter: World, all other games I've tried run fine except this one, but I can't figure out why.
This may be worth taking a look because it could be affecting other applications as well.

Are there any logs that I can provide that would be useful for investigating it ?

How exactly issue represents? Stream not starting? Or updates only when you move mouse in window? If last, you can try to stream game wind...

hot juniper
#

does it do that for mobile too?

real glade
azure verge
azure verge
#

i need to make a todo list of things i want to change in vesktop

simple groveBOT
real glade
simple groveBOT
#

something wrong with your system. nothing we can do

FWIW this seems to happen on fresh installs of both Debian 12 (stable at the time of writing) and 13 (testing): screensharing seems to work fine using Vencord's Flatpak release under X11, however trying to do the same under Wayland doesn't work at all, resulting in the same error @AprilTheCatgirl posted.

On the other hand, screensharing under Wayland with Vencord's native .deb package works flawlessly in Debian 13, while 12 has a lib...

#

@PolisanTheEasyNick sorry, I've added context to the original comment. The framerate is abysmally low.

I've tried running the game in windowed mode and full screen, and I also tried streaming both the game window and the whole screen, the issue persisted in all of the possible permutations involving these configurations

Could you do me a favor and open the debug menu and show what that menu looks like?

to open the debug menu, you need to:

  1. click on Voice connected in the bot...
#

I have issue: when I mouse mouse, the stream is lagging as hell. When cursor not moving, the stream is buttery smooth.
I recorded video to better see the issue. I use KDE Wayland, AMD RX 6900 XT, running second discord account in browser on second display to see my own stream. It doesn't matter if I stream whole display or specific window.

https://github.com/Vencord/Vesktop/assets/109820903/4c27e9ce-909c-4816-bf27-46f3949a4a38

simple groveBOT
#
vernal lintel
#

most informative github issue comment

simple groveBOT
vernal lintel
hot juniper
#

horror

vernal lintel
#

maybe we can do insane thing and patch their bundle to fix the issue

heady merlin
#

๐Ÿ’€

hot juniper
azure verge
azure verge
#

also

#

APPARENTLY HAVING A GAME OPEN LOCKS MY STREAMS TO MAX FRAMERATE???

#

im barely using any bitrate and streaming perfect 1080p60

heady merlin
#

forcing an error and running modified

vernal lintel
#

well we can just patch

#

it looks easy

#

lets see

simple groveBOT
#

here's a plugin that fixes the error until discord fixes it themselves. untested cause i'm too lazy to test audio quality, idk if it actually works or not

import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";

export default definePlugin({
    name: "KrispFix",
    description: "description",
    authors: [Devs.Ven],
    required: true,

    patches: [{
        find: "KrispSDK:init",
        replacement: {
            match: /=exports;/,
    ...
#

sorry but i dont think there is anything we can do for you. this is an issue with either your internet / network stack, or some dependency, or even discord itself

stuff like this is very much out of our control

my best advice is try reinstalling vesktop

I forgot to put it on the initial post, but I have already tried reinstalling Vesktop multiple times from different sources to no avail. I also mentioned that the exact same issue happens with Discord-Screnaudio, but also th...

azure verge
#

okay who's good at css

#

im trying to rotate this menu so everything fits better

#

how do i make it wider

hot juniper
#

what menu

azure verge
#

i tried width

hot juniper
#

display:flex and flex-direction

azure verge
#

already done

#

hence the

#

everything being sideways

#

its still stuck to the same width though

hot juniper
#

oh

#

the actual modal?

azure verge
#

yeah

#

i added a class to the div

#

and tried to edit it

#

i just wondered if there's something more than just

#

width

vernal lintel
#

ModalRoot takes a modal size

azure verge
#

yeah

vernal lintel
#

you'll want to change it to chonky

azure verge
#

o

azure verge
#

its also late and im half asleep

#

i gOT it

azure verge
#

WIP new screenshare modal

#

i can move it to another branch if people dont like the idea

#

i just feel like it makes sense that if im already adding a few options there i might as well make it a bit cleaner

vernal lintel
#

i don't think that looks good tbh

#

i'd just make the preview smaller

azure verge
#

alrighty

#

I'll do that tmrw

#

I pushed the changes just so I can mess with it on my laptop lmao

azure verge
#

so there's as much room as possible for how much there is to select

#

but

#

sources aren't getting a name for some reason

#

they never were

vernal lintel
#

names aren't reliable

#

apps can set title themselves

#

it can be anything, doesn't even need to contain the app name

azure verge
#

yeah

#

I just don't know what else to put

#

I worry even with no preview it's too big

hot juniper
simple groveBOT
#

here's a plugin that fixes the error until discord fixes it themselves. untested cause i'm too lazy to test audio quality, idk if it actually works or not

import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";

export default definePlugin({
    name: "KrispFix",
    description: "description",
    authors: [Devs.Ven],
    required: true,

    patches: [{
        find: "KrispSDK:init",
        replacement: {
     ...
simple groveBOT
simple groveBOT
#

here's a plugin that fixes the error until discord fixes it themselves. untested cause i'm too lazy to test audio quality, idk if it actually works or not

import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";

export default definePlugin({
    name: "KrispFix",
    description: "description",
    authors: [Devs.Ven],
    required: true,

    patches: [{
        find: "KrispSDK:init",
       ...
azure verge
simple groveBOT
#

Describe the bug

You can install Vesktop on Windows 7. This could cause github issues such as #363

To Reproduce

  1. Install Vesktop on Windows 7.
  2. You will get error, so people could accidentally make invalid issues.

Expected behavior

Cannot even install, like many modern apps or just warning.

Screenshots

There is no really good screenshot to choose, so not provided and it's definitively not needed in this case.

**Desktop (please complete the followi...

azure verge
#

@vernal lintel I've honestly not been able to be sure if any server side bitrate limitations exist other than the 4696 on dm calls(if it's even server side)

#

I have no idea what we should do

#

for non-nitro vs nitro

#

other than maybe lock the settings for streaming

simple groveBOT
azure verge
#

id prefer to remove scrolling on that modal

vernal lintel
#

i meant to make the preview smaller

azure verge
#

yeah

#

if i did

#

itd have to be basically nonexistent to fit the rest of the stuff

#

(mostly because of mic workaround but im not complaining if it fixes stuff lmao)

#

without a preview at all it fits well

#

hmm

#

i just liked the idea of the preview on the side

#

i could keep this part the same and just

#

slap it on the side

#

idk

#

its not super important

#

just dont want this to be too cluttered

azure verge
#

obviously this isnt done but maybe a show prievew button?

runic inlet
azure verge
#

nah

#

that seems like the kind of thing you want to advertise

#

preview is the least important thing on this menu

#

so therefore it should be of least priority to show

#

imo

runic inlet
#

or shorten the workaround text a bit

azure verge
#

may

#

be

simple groveBOT
#

Describe the bug

Discord crashes when I try to click on screenshare, specifically when reading drivers.

To Reproduce

Expected behavior

Read all drivers.

Screenshots

https://github.com/Vencord/Vesktop/assets/58144443/9188cd4c-4cac-4462-9c22-ebbaf3320ac4

Desktop (please complete the following information):

  • OS/Distro: Linux Mint
  • Desktop Environment (linux only): Cinnamon
  • Version: 22.04

Command line output

[arRPC > ipc] l...
hallow trail
#

Question, on kait's developing branch, does resizing the underlying window still break/ freeze the stream?

#

Other clients appear to suffer this want to know if the good old issue remains

#

Hmm, That and other streams starting boot out your own stream

ionic gust
#

.

#

and no its not a simple "reverse an array", its three calls to a function that end up sending in the wrong order if you're watching a stream

#

but it could be and im just blind

ionic gust
#

wild

azure verge
#

it was just uhhh

#

i had to check if the current stream had the current user ID in it

#

if not

#

start one

azure verge
#

have not tested

#

will test as soon as i get home

#

actually ill do it rn

#

what the hell

#

that is a WACKY issue

#

it mostly works

#

but it cuts off parts of the stream

#

like a bad crop

#

ill look into fixing that later but it may be another electron thing

#

we've found quite a few issues in electron

#

when the app's resolution updates

vernal lintel
#

i doubt it's fixable lol

azure verge
#

its not properly grabbed by the desktopcapturer

#

yeah

#

its not fixable by us afaik

#

electron may be able to do something

vernal lintel
#

it's a flaw in the capturer

azure verge
#

yeah

vernal lintel
#

that's the thing that sucks about using electron you have very little control about that stuff

azure verge
vernal lintel
#

like whenever someone opens any graphical glitch issues it's an instant wontfix + closed as not planned

azure verge
#

we've been debating dropping the capturer altogether for the raw webrtc apis for screensharing

#

but i shut that down as

#

way too much work

#

id rather bother electron

azure verge
#

electron also returns the wrong ID for windows and monitors

#

and on top of that

#

it doesnt return app names at all

#

hence the app name not working

#

their capturer is

#

a mess

#

we have some open issues rn

#

to see if they ever fix that lmao

#

btw

#

is there a way to store something and have it remain the same across app launches (like a user preference)

#

a simple boolean really

vernal lintel
#

settings api

azure verge
#

noted

azure verge
#

that's

#

a caturtle

vernal lintel
#

try sending less messages

#

one sentence per message :p

azure verge
#

sorry i didnt mean to bother
that's just how i type usually

#

i use CRLFs as a form of punctuation

vernal lintel
azure verge
#

yeah but then i cant use CRLF as punctuation
unless i do it like this and
do that

vernal lintel
#

wdym

azure verge
#

you know what crlf is right

#

carriage return line feed

vernal lintel
#

i just realised. that's, a catturtle

azure verge
#

basically

#

enter

#

lmao

azure verge
boreal warren
#

You can
Like
Put multiple lines
In one message

azure verge
#

you can just say you have this channel set to all messages or something and i wont do it but if its just preference i mean idk why i cant type however i want

upper current
#

you can use periods to add more spacing without line breaks. e.g.
I just realized. that's. a catturtle

#

or more crytyping style with commas
I just realized,, that's ,,, a catturtle??

vernal lintel
#

you can talk how u want, i was just giving u 'feedback' cause it makes it kinda hard to read your messages

splitting multiple sentences across messages is good, but you split like one sentence into 3 messages and it makes it hard to follow :p

like the example i gave that everyone is somehow misinterpreting "i just realised that's a catturtle", it's one sentence without any punctuation so splitting it into 3 messages is weird caturtle

upper current
#

that star guy from deltarune
I just realized that's a catturtle

azure verge
#

that's fair

#

i can try and be a bit more readable here

azure verge
vernal lintel
#

O.O

azure verge
#

resizeMode had to be set to "none"

#

it defaults to "crop-and-scale"

simple groveBOT
#

It seems that the screenshare function is cropping the output, but it's not adjusting the display to fit a 1080p canvas.

To illustrate, when I share a game running at 3440x1440 (21:9) resolution and set the screenshare to 1080p at 60fps, the image gets overcropped. However, in the official Discord client, the canvas is correctly scaled down to fit the selected resolution.

Screenshot example:
![814D8379-124D-4E4A-A765-59D1FC659C53_1_101_o](https://github.com/Vencord/Vesktop/assets/4710...

#

It seems that the screenshare function is cropping the output, but it's not adjusting the display to fit a 1080p canvas.

To illustrate, when I share a game running at 3440x1440 (21:9) resolution and set the screenshare to 1080p at 60fps, the image gets overcropped. However, in the official Discord client, the canvas is correctly scaled down to fit the selected resolution.

Screenshot example: ![814D8379-124D-4E4A-A765-59D1FC659C53_1_101_o](https://private-user-images.githubuser...

simple groveBOT
broken solstice
#

Hello, I have a little UX discussion around https://github.com/Vencord/Vesktop/pull/489 I would like some feedback on.
This is the new picker. I'm not too sure that keeping a Show Preview button here makes sense, if I understand correctly, it has been added to remove the preview to save up space to avoid having to scroll through the picker. I think that a new layout for this dialog would make more sense as the button already wastes some extra space for the default behaviour. A simpler, temporary, solution would be to increase the dialog's size by itself.
What does Vendicated think about this?

GitHub

basically what the title says. streaming is now smooth on linux. finally.

hybrid fjord
simple groveBOT
azure verge
#

it gives more room to expand on our options

#

while still showing the user what they chose

vernal lintel
#

i think it looks really awful in a horizontal layout

azure verge
#

interesting

vernal lintel
#

looks asymetric and pushes the main content to the side

azure verge
#

ahhh

vernal lintel
#

main content should be close to the centre imo

azure verge
#

that's a fair point

vernal lintel
#

like the controls are the main centre of attention

simple groveBOT
azure verge
#

mhm

vernal lintel
#

so it should be central imo

azure verge
#

which is why it bothers me that the audio controls are pushed off the modal and you have to scroll to them

vernal lintel
#

imo either a collapsed thing or something you hover would be cool

azure verge
#

oooh

#

hm

#

collapsed thing that has the preview in it?

#

or options

#

i think not options personally

vernal lintel
#

yes the preview

azure verge
#

alr

vernal lintel
#

well actually lets just check how it looks in stock discord

azure verge
#

it uses app name i believe

vernal lintel
azure verge
#

PFF

#

yeah

vernal lintel
#

honestly that dropdown for quality is cool

#

maybe we could do that too

azure verge
vernal lintel
#

instead of that radio

azure verge
#

content type

#

oo

#

oki

vernal lintel
#

then you could also move this info into the dropdown

#

and win some vertical space

azure verge
#

oooooooooh

#

i feel like another win would be to minimize the microphone workaround somehow

vernal lintel
#

im thinking for the preview we could do something like this and when you hover it shows the preview as tooltip

azure verge
#

that box usually shows the app name if you're not streaming your screen

#

what if i

#

add the change button

#

that would automatically make the box bigger

vernal lintel
#

anyway dont worry about the ui tbh

#

functionality is more important

azure verge
#

true

#

as of rn i just found another bug??????

#

it now always chooses 30fps

#

lemme try to force 60

#

nope

#

still 30

#

what the hell

hybrid fjord
#

lol, for me too

azure verge
#

wha

#

this is weird

#

it was working just fine

#

did discord change something??????

#

am i

#

i think its limited to 720p30

hybrid fjord
#

But 15 fps limit setting up successfully. Means that our configuration works

azure verge
#

mine wont go above 720p

hybrid fjord
#

mine too, only fps setting

azure verge
#

did discord change something......

#

fucking hell

#

i swear if we have to stop faking browser useragent

#

@vernal lintel do you know anything

vernal lintel
#

i know nothing sorry

azure verge
#

you're fine

azure verge
#

SZAME

hybrid fjord
#

while negotiationgs looks like we receive from servers something like:
[UnifiedConnection(stream)] updateVideoQuality: {
"remoteSinkWantsMaxFramerate": 30,
"encodingVideoFrameRate": 30
}
Maybe we can change it using the same way like we patched bitrate?

azure verge
#

maybe

#

ill check discord source

hybrid fjord
#

also after it we can see in logs this:
...
"maxBitrate": 8000000,
"maxFrameRate": 30,
...

azure verge
#

ooo

#

h

hybrid fjord
#

so looks like it does setups this settings

#

heh or we can just try to call this updateVideoQuality function somehow and setup our values xD

azure verge
hybrid fjord
#

we may set this maxFrameRate in our overrided getDisplayMedia function?

azure verge
#

maybe????????

hybrid fjord
#

i will try, but i do not really know how to properly set it

azure verge
#

its also forcing lower resolution

#

god damnit discord

hybrid fjord
#

looks like a war

azure verge
#

looks like

#

uhh

#

uhh idk

#

i wanna just

#

blows up discord

hybrid fjord
#

1920/1.5 is just 1280

azure verge
#

yep

hybrid fjord
#

xD maybe we can override functions of UnifiedConnection to do nothing?

azure verge
#

idfk

#

hmm

hybrid fjord
#

but then it may not change resolutions where there are lack of bitrate. (maybe it is even a plus? On full hd we will always receive fullhd)

azure verge
#

hmm

hybrid fjord
#

any ideas how to get UnifiedConnection object in code?

azure verge
#

i may try and patch the encodingVideoFrameRate

hybrid fjord
#

Can someone test streaming start when someone else have already enabled stream? Looks like it is broken for me in local p2p call

azure verge
#

oh god damnit

#

what the fuck

#

empty error

#

AUGH

#

i cannot do this today

hybrid fjord
#

yeap, same for me

azure verge
#

lmao

#

i need a break sjadfghadlksjfglsdkfg

#

it was working ๐Ÿ˜ญ

simple groveBOT
azure verge
#

maybe its a regression in a commit?

#

nope

hybrid fjord
#

it actually looks like some webrtc broken things.. or portal or smth

azure verge
#

i have

#

no

#

idea

#

is it this???????

hybrid fjord
#

tf is videoBudget at all

#

looks like discord proprietary things

#

but we can try change all here

#

if you know how to get it in code

azure verge
#

god

#

i am at such a loss

#

something is hardcoded to lock this

#

it definitely needs to be patched

#

i just dont know what to do

hybrid fjord
#

okay, so what we have:

  1. broken starting stream when someone streaming. When checking if there is another stream we use connection from MediaEngineStore
  2. broken track settupping of framerate and resolution. Track is getting from same connection
    so maybe problem with connection object or smt?
#

it just hard to believe that two +- different issues are appeared at same time

azure verge
#

hmm

#

yk what

#

i think you're on to something

hybrid fjord
#

IT IS

#

conn is undefined

#

which returned from MediaConnectionStore

#

try:
const conn = [...MediaEngineStore.getMediaEngine().connections][1];
console.log("Connection: ", conn);
And it will print:
Connection: undefined

#

why here [1]..

vernal lintel
#

discord watching the pr and trolling us

azure verge
azure verge
hybrid fjord
#

xd

azure verge
#

IF THATS THE CASE IM MARCHING MYSELF OVER THERE AND SLAPPING WHOEVER BROKE IT

#

@vernal lintel can i get the vencord contributor badge pleadingtaco burgerpleading

azure verge
#

wait

#

i can print conn

hybrid fjord
#

something on my end this

#

then*

#

i'm in local call, maybe it is a reason?

#

i dunno

#

i have only like this

azure verge
#

odd

#

and it still

#

well its still normal

#

its just locked to low framerate

#

and low resolution

hybrid fjord
#

ohh

#

so close and so far

azure verge
#

yeah

vernal lintel
#

it works via the Devs object in src/utils/constants.ts in vencord codebase

#

need to add u there lol

azure verge
#

its hardcoded into vencord isnt it- omg

#

that's fair lol

#

ill just add it after i work on volume booster

#

im focused on this rn lmao

hybrid fjord
#

i got connection object when changed window for stream

#

but undefined on creation

azure verge
#

yeah

#

it checks existing streams

hybrid fjord
#

funny that bitrate target is around 8k for nitro

azure verge
#

@broken solstice opinions on all of this?

hybrid fjord
#

Look

#

i store input object as global variable, got MediaStream and here is 30 fps it track

#

and even no resolution variables

#

maybe somewhere in code we can get again this videotrack and patch it again

azure verge
#

maybe

broken solstice
hybrid fjord
broken solstice
#

One sec, catching up the messages ๐Ÿ™‚

broken solstice
simple groveBOT
azure verge
hybrid fjord
azure verge
#

did we ever patch the sender?

hybrid fjord
#

i think no, but it may be got when we patch while creating stream

broken solstice
hybrid fjord
#

i mean created track may be putted in transceiver's sender object

azure verge
#

updated something

#

and it all died

broken solstice
#

Well

#

Interesting

azure verge
#

encodingVideoFrameRate is new

broken solstice
#

Yep, my stream is at 720p30 again

#

Confirmed, it was working fine a few hours ago

azure verge
#

i mean its still better than 1440p5

broken solstice
#

But target bitrate is somehow 6951 in private call?

azure verge
#

interesting????

hybrid fjord
# azure verge

can we try to change it using patches like "find"->"replace"?

broken solstice
hybrid fjord
azure verge
broken solstice
#

Sorry, Anoushka wasn't watching

#

It's locked just like before...

#

Thought they were

azure verge
#

oh lmao

vernal lintel
#

i mean its easy to find

#

its inside applyQualityConstraints

hybrid fjord
#

but i'm not sure it will help in all problems(
resolution still broken

hybrid fjord
azure verge
vernal lintel
#

read the code

hybrid fjord
#

i think we may also try to set constraints in track object, looks like discord taking res and fps info from this object

#

at least was taking

vernal lintel
#
constraints.encodingVideoFrameRate = quality.encode.framerate;
azure verge
#

interesting

vernal lintel
#
getQuality(e) {
            var t, n, i;
            let r = this.isStreamContext ? this.getDesktopQuality() : this.getVideoQuality(this.connection.getLocalWant(e));
            return new o({
                encode: l.extend(r.encode, this.qualityOverwrite.encode),
                capture: l.extend(r.capture, this.qualityOverwrite.capture),
                bitrateMin: null !== (t = this.qualityOverwrite.bitrateMin) && void 0 !== t ? t : r.bitrateMin,
                bitrateMax: null !== (n = this.qualityOverwrite.bitrateMax) && void 0 !== n ? n : r.bitrateMax,
                bitrateTarget: null !== (i = this.qualityOverwrite.bitrateTarget) && void 0 !== i ? i : r.bitrateTarget,
                localWant: r.localWant
            })
        }
setQuality(e) {
            this.qualityOverwrite.capture = e.capture,
            this.qualityOverwrite.encode = e.encode,
            this.qualityOverwrite.bitrateMin = e.bitrateMin,
            this.qualityOverwrite.bitrateMax = e.bitrateMax,
            this.qualityOverwrite.bitrateTarget = e.bitrateTarget
        }
azure verge
#

thank god i can read it now

vernal lintel
#

but we already have a patch for that

azure verge
#

yeah

#

thought so

#

does that no longer change

#

framerate

sour muralBOT
# vernal lintel thats https://github.com/Vencord/Vesktop/blob/main/src/renderer/components/Scree...

**ScreenSharePicker.tsx: **Lines 55-83

    patches: [
        {
            find: "this.localWant=",
            replacement: {
                match: /this.localWant=/,
                replace: "$self.patchStreamQuality(this);$&"
            }
        }
    ],
    patchStreamQuality(opts: any) {
        if (!currentSettings) return;

        const framerate = Number(currentSettings.fps);
        const height = Number(currentSettings.resolution);
        const width = Math.round(height * (16 / 9));

        Object.assign(opts, {
            bitrateMin: 500000,
            bitrateMax: 8000000,
            bitrateTarget: 600000
        });
        Object.assign(opts.capture, {
            framerate,
            width,
            height,
            pixelCount: height * width
        });
    }
});
vernal lintel
#

it seems that our patch is outdated

#

the api changed now

azure verge
#

i would never have guessed

vernal lintel
#

this

Object.assign(opts.capture, {
    framerate,
    width,
    height,
    pixelCount: height * width
});

needs to be adapted to the new api

broken solstice
#

Btw, jokes aside, we need to be very careful around the resolution/bitrate thing. It's, unfortunately, discord's right to cap that for non-nitro users.
If anything gets down to users, it needs to be "safe" around the TOS as much as reasonably possible...

azure verge
#

im still learning how patches work

broken solstice
#

Sure, there will be plugins to override that safety for those who so choose but it shouldn't be automatic

vernal lintel
#
Object.assign(opts.encode, {
    framerate,
    pixelCount: height * width
});
Object.assign(opts.capture, {
    framerate,
    width,
    height
});
#

try this

azure verge
#

OH i see

#

oki

hybrid fjord
#

that what i have with this

#

but framerate still 30

azure verge
#

@vernal lintel oh my god you fucking

#

thank you

vernal lintel
#

wow so mean :(

azure verge
#

HAHDJHKLASGJDKHG AHJS

hybrid fjord
#

xD

azure verge
#

:(

vernal lintel
azure verge
#

see i would like
not say it in multiple messages

#

but i had no words

#

it works now

#

at least for me

#

let me push this

#

and see if it still works for others

broken solstice
#

Checking rn

azure verge
#

also im in dm call and i have max bitrate?

#

8000kbps

#

i think it was just a broken api

broken solstice
#

I'll test as soon as you commit

hybrid fjord
#

in some reason im stick with 30 fps, so test it plz too

vernal lintel
#

idk if thats a good idea

azure verge
vernal lintel
#

like not everyone has a 16x9 screen

#

nor is every window 16x9

azure verge
#

shit

#

you right

#

hmm

#

well

#

the reason it does that is cuz height is the label (480, 720, 1080, 1440)

hybrid fjord
#

yeah, i thougth about it
We must create currentSettings.width parameter and rename resolution to height

azure verge
#

but

#

hmm

#

but how do we let the user choose

#

choosing low resolutions on windows still works

hybrid fjord
#

i think for window we may just let discord to change resolutions itself

azure verge
#

even if the window is super square

hybrid fjord
#

we need to test it

azure verge
#

yeah

#

ill get out my old crt sometime

#

so i can use a 4:3 screen

hybrid fjord
#

xd

vernal lintel
#

welll i assume we can get dimensions of the thing shared

hybrid fjord
vernal lintel
#

we can just use the aspect ratio of that instead

broken solstice
#

Bitrate still capped

azure verge
#

but hey

#

framerate and res are back

broken solstice
#

are you sure someone was watching that?

hybrid fjord
#

at least fps and res working

azure verge
#

god damnit

#

what the fuck

broken solstice
#

As I've told you, I know the ways, I see them patterns ๐Ÿ™‚

hybrid fjord
#

i think it is in discord web backend

#

it so ideal number

azure verge
#

maybe

#

eh

#

not a big deal

#

we dont go near it

#

once stream stabilises

#

1080p 51fps is only 964kbps

hybrid fjord
azure verge
#

mhm

broken solstice
#

Also, is the starting a stream while watching another fixed as of rn?

hybrid fjord
#

i can't test rn

azure verge
#

let me check

broken solstice
#

Switching doesn't work btw

#

like, from screen to window at least

hybrid fjord
#

conn is "undefined" issue?.. if you can reproduce this

broken solstice
#

I'm not sure I can do anything more complex than a little testing after 8 hours of conservatory and 2 of programming

#

and now studying guitar cause I have lesson tomorrow

azure verge
#

alright uhh

#

i can start a stream

#

but its infinite loading now

hybrid fjord
#

it is just like walking by circle..

#

we meet all bugs that met two past days

broken solstice
#

The most crucial one we never fixed tho eheh

azure verge
#
// If there are 2 connections, the second one is the existing stream.
                        // In that case, we patch its quality
                        try {
                            var conn = [...MediaEngineStore.getMediaEngine().connections].find(
                                connection => connection.streamUserId === UserStore.getCurrentUser().id
                            );
                        } catch {
                            console.log("No current stream.");
                        }
                        console.log([...MediaEngineStore.getMediaEngine().connections]);
                        try {
                            if (conn.streamUserId === UserStore.getCurrentUser().id) {
                                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();
                                const newConstraints = {
                                    ...constraints,
                                    frameRate,
                                    advanced: [{ width: width, height: height }],
                                    resizeMode: "none"
                                };
                                track.applyConstraints(newConstraints).then(() => {
                                    console.log("Applied constraints from ScreenSharePicker successfully.");
                                    console.log("New constraints:", track.getConstraints());
                                });
                            }
                        } catch {
                            console.log("No current stream.");
                        }

#
try {
    if (!conn || conn.streamUserId !== UserStore.getCurrentUser().id) {
        submit({
            id: selected!,
            ...settings
        });
    }
} catch {
    console.log("Unable to start stream.");
}
#

that's the stream code

#

ima test if it works

vernal lintel
#

lmao why manually include the filename and line

azure verge
#

does it

#

already

vernal lintel
#

if u enable sourcemaps, devtools automatically shows u

azure verge
#

O H

#

well then

vernal lintel
#

:p

#

Logger.ts:35

azure verge
#

omfg

vernal lintel
#

and u can even jump to it

azure verge
#

i knew that

#

i

#

im still broken from thinking my past few days of nonstop work on streams was gone

#

okay

#

so

#

what the hell

#

there's a stream with my uid

#

as the streamuserid

#
if (conn.streamUserId === UserStore.getCurrentUser().id) {
                             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();
                             const newConstraints = {
                                 ...constraints,
                                 frameRate,
                                 advanced: [{ width: width, height: height }],
                                 resizeMode: "none"
                             };
                             track.applyConstraints(newConstraints).then(() => {
                                 console.log("Applied constraints from ScreenSharePicker successfully.");
                                 console.log("New constraints:", track.getConstraints());
                             });
                         }
#

something here didnt work

#

hmm

hybrid fjord
#

what if we check whether userId and streamUserId is same? Like for WebRTC-2
Or i do miss smth

#

i think we need try to log what UserStore.getCurrentUser().id returns

broken solstice
#

Couple of logs from latest MR version:

(node:319439) UnhandledPromiseRejectionWarning: TypeError: Video was requested, but no video stream was provided
    at AsyncFunction.<anonymous> (VCDMain:40:2411)
(Use `vesktop.bin --trace-warnings ...` to show where the warning was created)
(node:319439) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
hybrid fjord
#

TypeError is new one
I had this error when my xdg-desktop-portal needs restart and i have this error when i cancel picking screen for streaming

broken solstice
#

huh

#

interesting

#

I will report if I find further stuff

#

I'm considering how to prep for tomorrow's lesson

#

Cause I'm hella tired

hybrid fjord
azure verge
broken solstice
#

Don't forget the cursor thing making fullscreen streaming unusable

hybrid fjord
hybrid fjord
azure verge
#

idk if the if statement is broken or not

#

lemme console.log inside of it

simple groveBOT
azure verge
#

i CAN STREAM ARBITRARY RECTANGULAR REGIONS LMAO

broken solstice
#

huh, I wonder about something

#

I mean, I don't think GNOME's xdg desktop portal can do that actually

#

I wonder if that would have the same issue as full monitor streaming

azure verge
hybrid fjord
#

ohh it is strange issue

simple groveBOT
azure verge
#

ahh

#

this fails

#

conn.input.stream is undefined

#

lemme see why

#

i think its an edge case

#

lemme try stuff

hybrid fjord
#

you can enter overwatch vc for testing starting when someone streaming if you want

azure verge
#

im in a vc already

#

hm

#

okay so

hybrid fjord
#

okay

azure verge
#

we cannot switch windows as of rn

hybrid fjord
#

i acn

#

i can and it switches fps

azure verge
#

because we bypass submit if the stream exists

hybrid fjord
#

and res

azure verge
#

but not streamed window

hybrid fjord
#

hm

azure verge
hybrid fjord
#

yes, windows not changing

azure verge
#

thought so

#

hmm

simple groveBOT
azure verge
#

i could check if that's equal to a new stream or something

#

and if not

#

replacetrack

#

if it is equal

#

dont replacetrack

hybrid fjord
#

found out that if we start stream window then fps for it will vary only when window updates. It confirms my theory about displaySurface type. Looks like Gnome or Gnome's portal did some optimizations of redrawing display or smth

azure verge
#

interesting

hybrid fjord
azure verge
#

i cant find window id on conn

#

btw

#

if it was supported by VA-API

#

id love to use one of these

simple groveBOT
azure verge
#

VP9 is already enabled

#

just the driver is what doesnt support it

hybrid fjord
#

it is a bug actually that we might fix in .tsx?

azure verge
#

not sure

#

its not a priority though

simple groveBOT
hybrid fjord
#

yeap

#

for not now

azure verge
#

wait

#

let me try something

hybrid fjord
#

hehe what if we in conn object just change videoCodec property?

azure verge
#

fixed it

#

changing windows works now

hybrid fjord
#

how

azure verge
#

it was WAY easier than i thought

#

i just update the track after replacetrack is called KEKW

hybrid fjord
#

xd

azure verge
#

omfg

hybrid fjord
azure verge
hybrid fjord
#

๐Ÿ˜ฆ

azure verge
#

it would fall back to H264 no matter what

#

H265 is like our only chance and its

#

not exactly supported

hybrid fjord
#

okay, looks like we returned to previous state

azure verge
#

yeah

#

okay

#

biggest issue

#

cannot start stream when watching another stream

#

this is all that's left that isnt

#

bitrate related

hybrid fjord
azure verge
#

no

#

hm

#

or i think no

#

also

#

apparently changing windows cannot bring the resolution up from 30 to 60

#

just down from 60 to 30

hybrid fjord
#

i have theory

#

look

#

we getting connections array and getting [1] from it
But when we start watching stream, then it is already connection

#

ill investigate more

simple groveBOT
azure verge
#

lmk if you find anything

#

im probably gonna stop working on this for tonight

simple groveBOT
broken solstice
#

I mean, we're INCORRECTLY setting Window to Display which might be the root cause. What's being tracked? the cursor, for sure, it's the only thing that would cause a re-update no matter what in theory.

#

Also yeah, when streaming the console the framerate is lowered to only screen updates unless I move the cursor, even on a different surface (or monitor)

#

It looks like, by streaming the screen as a window, we're failing to track screen changes and only tracking cursor updates

azure verge
#

but yet

#

i have none of those problems

broken solstice
#

yeah, the question now, is it GNOME or the custom software stack I'm running?

#

I'm going to test it hopefully soon

azure verge
#

want me to install gnome and find out

broken solstice
#

If you want but you also have an AMD GPU so it might also play a role

azure verge
#

we shall see

broken solstice
#

I actually realised that I have had broken screen capture in GNOME itself since I built my custom pipewire and rolled back from Rawhide...

#

Basically, they changed the API for GStreamer 1.24 and a future Pipewire version

#

I have backported the Pipewire stuff

#

But I'm no longer on Rawhide so there's probably an API break with GStreamer 1.23

#

GNOME also added support to the new explicit API some time ago

#

I'll just rebase to Rawhide and test

#

then rollback and also test with stock pipewire

#

At worst I could reset to a stock image temporarily

#

The things I do instead of sleeping or studying Guitar eh

#

But hey, I fixed the state transitions in FlatSync, for now

hybrid fjord
#

okay for now i have infinite loading when created stream but instant loaded stream if i change window for resolution

azure verge
#

yeah but is the new stream able to be 60fps

hybrid fjord
#

xd no

azure verge
#

yeah that's what im trying to figure out

hybrid fjord
#

but any ideas how to fix start of streaming?

azure verge
#

not sure rn

hybrid fjord
#

okay so look what i got
when we change window then in some reason constraints are not applied.
But i tried to apply them right into console like this:
temp1.stream.getVideoTracks()[0].applyConstraints({ ...temp1.stream.getVideoTracks()[0].getConstraints(), frameRate: 60 })
And i got 60 fps. Interesting thing that resolution upped to 1920, but i didn't specified it

azure verge
#

interesting

#

so it just needs reapplied

#

okay main issue is the dead stream on stream start while watching a stream

hybrid fjord
azure verge
#

i think we do

#

i think its not applying properly because of other stuff

azure verge
hybrid fjord
#

I have idea to try patch constaints directly in submit function

#

YOU KNOW WHAT

azure verge
#

huh

hybrid fjord
#

IT IS BROKEN IN DISCORD WEB

azure verge
#

omg

hybrid fjord
#

it is even not our problem

azure verge
#

hm

#

we should still fix the framerate being shit

#

like

#

how it doesnt go back up

hybrid fjord
#

when you create stream then connection creates but there are no stream object in conn.input

azure verge
#

yeah

#

ik

hybrid fjord
#

if we use stock webrtc functions instead of electron then we can create stream ourselves and just pass it into conn.input...
But i think we really should just wait for discord to fix it

azure verge
#

alright

#

@vernal lintel opinion on that?

hybrid fjord
#

i think we may work on reapplying constraints on change window button

#

omg why discord is so shitty ahaha

#

community must find and fix bugs in discord web

broken solstice
#

Okay

#

the cursor bug still happens in rawhide

#

I'll test stable without patches tomorrow

#

Good luck with the rest ๐Ÿ™‚

azure verge
hybrid fjord
#

i think we may just ask some another users on gnome with gnome portal to test it

azure verge
hybrid fjord
#

gnome download time xD

azure verge
broken solstice
#

Yeah, if anyone could test this, especially on Nvidia, it would be great

#

Keep in mind there's a good chance it's an issue with my custom stuff if no one else can reproduce it

simple groveBOT
real glade
azure verge
#

nvm that

real glade
#

or don't use the plugin

azure verge
real glade
azure verge
#

in that case

#

lets figure out how to remove the weird 4696 bitrate limit its getting annoying

simple groveBOT
simple groveBOT
humble mortar
#

oh and apparently chromium vaapi with amd gpus is also broken so i cant even use hardware enc/decode on it

broken solstice
#

Although, to be honest they should be limiting this stuff server side anyways

broken solstice
#

I wonder if this limitation is present on Firefox btw

ionic gust
#

annie/dark had spotify autopause and nitro screenshare settings patched out

#

if they actually cared they would have strong enforcement on resolutions and bitrate, but thats unrealistic

#

cause its how source quality functions as is

hot juniper
#

brilliant job discord

vernal lintel
vernal lintel
#

i mean i doubt anyone at discord gives a fuck about the spotify autopause, it's probably just cause spotify demanded it as part of the partnership

ionic gust
#

idk ask annie (prob laid off remote worker so tr)

vernal lintel
#

annie fired for her crimes

#

are u sure annie is the name of the staff and not just a codename

simple groveBOT
broken solstice
simple groveBOT
hybrid fjord
#

"Fix bug where changing windows allows you to lower the fps but not raise it" - i can't reproduce it. Can someone retest?

#

Also found floating bug that running stream can just die. Propably discord negotiations breaking something? Or just problem with my system