Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Window screensharing low FPS, no audio in Window screensharing #153

Open
Daki0082 opened this issue Nov 11, 2023 · 13 comments
Open

[Bug] Window screensharing low FPS, no audio in Window screensharing #153

Daki0082 opened this issue Nov 11, 2023 · 13 comments
Labels
bug Something isn't working TODO

Comments

@Daki0082
Copy link

Describe the bug
Every time I share my screen on Dorion, my friends say that my game runs at 5 FPS. And when my game is in full screen, my friends only see a still image of my game. They only see my game moving when I tab out of the fullscreen game, again at 5FPS. This only happens on Dorion, not on the normal Discord app.

To Reproduce

  • Open Dorion
  • Call a friend or join a voice channel
  • share your screen

System Info (please complete the following information):

  • OS: Windows 11
  • Version: happens on all Dorion versions
@Daki0082 Daki0082 added the bug Something isn't working label Nov 11, 2023
@Daki0082 Daki0082 changed the title Screen Sharing with like 5FPS and Screen Sharing not playing when in fullscreen[Bug] Screen Sharing with like 5FPS and Screen Sharing not playing when in fullscreen [Bug] Nov 11, 2023
@SpikeHD
Copy link
Owner

SpikeHD commented Nov 11, 2023

Looks like this might be due to this bug with the VP9 codec. I think I can experiment with forcing the VP8 codec but no promises 😄

@SpikeHD SpikeHD changed the title Screen Sharing with like 5FPS and Screen Sharing not playing when in fullscreen [Bug] [Bug] Screen Sharing with like 5FPS and Screen Sharing not playing when in fullscreen Nov 11, 2023
@Daki0082
Copy link
Author

Okay, thanks!

@SpikeHD SpikeHD added the TODO label Nov 17, 2023
@SpikeHD
Copy link
Owner

SpikeHD commented Nov 17, 2023

@Daki0082 Okay, after some investigation, this seems to be more of a "thing" than I thought, so if you're willing, I'd like to get you to answer/try a couple things for me:

  1. What is your setup like? Are you using multi-monitors? Are you using 1 monitor connected to your motherboard, and one connected to your dedicated GPU? Do you even have a dedicated GPU?
  2. Open the DevTools console in Dorion (Ctrl+Shift+i) and paste and run the following code (yea yea I know this is sketch, you don't have to if you don't want to). This will output your GPU details, I want to make sure whatever hardware you're running is getting detected properly since Dorion should use hardware acceleration. Just paste the output back to me:
var canvas = document.createElement('canvas');
var gl;
var debugInfo;
var vendor;
var renderer;

try {
  gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
} catch (e) {}

if (gl) {
  debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
  vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
  renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
}

console.log(vendor)
console.log(renderer)

Mine outputted:

Google Inc. (NVIDIA)
VM692:20 ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)
  1. If you have a friend willing to put in some time (NOT just using an alt locally, that won't give accurate data. trust me, I've tried, lol), I'd like you to look at the following:
    a. You, in Dorion, start a screenshare like normal, ideally of a game or something you know tanks the FPS
    b. Your friend, in a normal client, opens the stream. Then, they click the green "Voice Connected" text, and on the bottom of that popup, they should see "Debug". Click that. If it doesn't show up, enable debug mode in Discord and try again.
    image
    c. In the box that should now appear, they click on the user (you) that is streaming (under "RTC Debug: Media"), which should open something like below. Make sure it is the "Video" debug tab, not "Audio". Screenshot that and send it here as well, below is what you're looking for:image

I will also hopefully remember to at least add an option for disabling hardware acceleration in the next release which may or may not help, if I am unable to fix this before the next one.

For any nerds reading, my thoughts:

  1. Since WebRTC is P2P, it is interesting that when reproducing locally (Dorion streaming and browser viewing, on the same PC), this problem seems to not exist. This suggests it could be a network-related problem?
  2. Screensharing also loves to crank the CPU like soulja boy. I'm noticing in Task Manager that screensharing uses GPU 0 (Intel HD). Unsure why that's the case when Dorion detects my GPU just fine, but it may be because I use a weird setup that uses the iGPU for one monitor, and my 3070 for the other?

@SpikeHD
Copy link
Owner

SpikeHD commented Nov 17, 2023

Tested with a friend as well, my findings. Firefox was my browser:

  1. Browser screensharing good. Closer to 30fps. Bitrate was fine.
  2. Dorion screensharing consistently bad. Never faltered from low FPS (5-ish). Bitrate was fine.
  3. Browser webcam consistently good. Close to target FPS. Bitrate and resolution matched target.
  4. Dorion webcam started bad, then gradually improved. Started at low FPS, went up to close to target. Bitrate started terrible as well, ended about the same as browser.

All-in-all, I think something is up with WebView2s implementation of screensharing, as webcam seemed to work fine. Going to look into this further but you are still welcome to answer the stuff above.

EDIT: tested with Chrome (as that is what WebView2, AKA MSEdge, runs under the hood), results:

  1. Webcam -> Exact same as Dorion, started bad and made its way to good
  2. Screenshare -> Only marginally better, if at all. Max FPS also low, bitrate was fine

This at LEAST means I can Google "low fps chrome" instead of "low fps webview2", which should give me better results, lol

@SpikeHD
Copy link
Owner

SpikeHD commented Nov 17, 2023

@Daki0082 Another discovery: streaming a full desktop instead of a window will make the framerate totally fine. You can also share audio when streaming entire desktops instead of Windows. Give that a try, see if that is the case for you as well.

@SpikeHD
Copy link
Owner

SpikeHD commented Nov 17, 2023

Created an upstream issue in WebView2Feedback: MicrosoftEdge/WebView2Feedback#4176

@Daki0082
Copy link
Author

@Daki0082 Okay, after some investigation, this seems to be more of a "thing" than I thought, so if you're willing, I'd like to get you to answer/try a couple things for me:

  1. What is your setup like? Are you using multi-monitors? Are you using 1 monitor connected to your motherboard, and one connected to your dedicated GPU? Do you even have a dedicated GPU?
  2. Open the DevTools console in Dorion (Ctrl+Shift+i) and paste and run the following code (yea yea I know this is sketch, you don't have to if you don't want to). This will output your GPU details, I want to make sure whatever hardware you're running is getting detected properly since Dorion should use hardware acceleration. Just paste the output back to me:
var canvas = document.createElement('canvas');
var gl;
var debugInfo;
var vendor;
var renderer;

try {
  gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
} catch (e) {}

if (gl) {
  debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
  vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
  renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
}

console.log(vendor)
console.log(renderer)

Mine outputted:

Google Inc. (NVIDIA)
VM692:20 ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)

This is what mine outputted:

Google Inc. (NVIDIA)
ANGLE (NVIDIA, NVIDIA GeForce GTX 1650 (0x00001F0A) Direct3D11 vs_5_0 ps_5_0, D3D11)

I'm going to ask a friend of mine to help me soon. I will respond again with the screenshot when I have it

@Daki0082
Copy link
Author

Here's the screenshot of the debugging thing:
image

@SpikeHD
Copy link
Owner

SpikeHD commented Nov 17, 2023

Okay, thank you, it seems it is what I feared most: a bug with the underlying browser engine :(

I can't fix this myself, but I did submit a (hopefully) detailed issue in WebView2Feedback, so hopefully that leads to something. In the meantime, you can try screensharing your entire desktop instead of specific windows, since I'm pretty sure the bug is present in the window capturing system. At least, sharing my desktop works fine for me, feel free to report back if it doesn't for you 😄

@cozykitten
Copy link

Fullscreen sharing with audio, same problem, friend also said it looked like 5fps

Google Inc. (NVIDIA)
VM447:18 ANGLE (NVIDIA, NVIDIA GeForce GTX 1060 6GB Direct3D11 vs_5_0 ps_5_0, D3D11)

image

@SpikeHD
Copy link
Owner

SpikeHD commented Dec 20, 2023

Yep, nothing I can do until the upstream issue gets an update!

@SpikeHD SpikeHD changed the title [Bug] Screen Sharing with like 5FPS and Screen Sharing not playing when in fullscreen [Bug] Window screensharing low FPS, no audio in Window screensharing Jan 9, 2024
@noideas4thisname
Copy link

noideas4thisname commented Feb 4, 2024

Yep, definitely encountered this. Makes Dorion unusable for this use case at the moment. Unfortunately upstream seems to not have any traction that we can see.

@SpikeHD
Copy link
Owner

SpikeHD commented Sep 19, 2024

I've experimented with the Vencord webScreenShareFixes plugin, and it seemed to bring the bitrate from ~2500 Kbps to ~3500 Kbps but in more complex scenarios (I tested with Overwatch practice range) it still has very poor FPS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working TODO
Projects
None yet
Development

No branches or pull requests

4 participants