SpacingBat3 / WebCord

A Discord and SpaceBar :electron:-based client implemented without Discord API.
MIT License
1.88k stars 94 forks source link

Unusable framerate on linux screenshare #395

Closed arazadaz closed 1 year ago

arazadaz commented 1 year ago

Aknowledgements

Operating System / Platform

🐧️ Linux

Operating system architecture

x64 (64-bit Intel/AMD)

Electron version

22.0.0 / 108.0.5359.62 / 16.17.1

Application version

4.1.1

Bug description

On prime system setups like laptops where the screen is rendered with an integrated gpu while games/gpu intensive applications are usually offloaded to a dedicated gpu, it seems that the screenshare doesn't perform well.

In my case, whenever I try to screenshare a game, everyone says that the stream is awful and under 5 frames per second. My setup is a nvidia gtx 1660/intel igpu. I've tried running it on the igpu as well offloading it to the nvidia gpu. The nvidia gpu doesn't work at all as it will share a black screen, but the igpu offers extremely poor performance. I have no way of confirming if this is because of the prime setup easily or some other factor, but it's the only thing I can think of that could be causing the poor performance.

Additional context

No response

arazadaz commented 1 year ago

After looking at issue #396

I think this is just the same issue, but here's my log anyhow. It might not have anything to do with it being a prime setup.

log file ``` ./WebCord-4.1.1-x64.AppImage` --verbose [OPTIMIZE] Applying flag: --enable-features=WebRTCPipeWireCapturer... [FEATURE] Disabling 'MediaSessionService'... [FEATURE] Disabling 'HardwareMediaKeyHandling'... [L10N] Computing strings for locale list: en-US, en_US, en, US, EN-US, en-us [L10N] Computing strings for locale list: en-US, en_US, en, US, EN-US, en-us [L10N] Computing strings for locale list: en-US, en_US, en, US, EN-US, en-us [WebSocket] Listening at port 6463. [112983:0330/195331.087857:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable. [WIN] Electron event: maximize [WIN] State changed to: {"width":1165.3333333333335,"height":877.3333333333333,"isMaximized":true} [CSP] Caching function arguments... [UPDATE] Application is up-to-date! [PAGE] Starting to load the Discord page... [WIN] Electron event: unmaximize [WIN] State changed to: {"width":1165.3333333333335,"height":877.3333333333333,"isMaximized":true} [IPC] Exposing a `getDisplayMedia` and spoffing it as native method. [API] Blocking /cdn-cgi/challenge-platform/h/b/scripts/alpha/invisible.js [113024:0330/195341.993605:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: BGRA_8888, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195342.022355:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: BGRA_8888, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195342.027816:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: BGRA_8888, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195342.034043:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: BGRA_8888, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195342.043210:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: BGRA_8888, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195342.418966:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: BGRA_8888, share_between_threads: 0, gmb_type: shared_memory [Mention] Hash: 6731e3f16edc94c6b89a815a579e076bb4d792bd [API] Blocking /api/v9/science [Mention] Hash: de96a6be5d431a97cb94f623d5940e2526db8280 [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [API] Blocking /api/v9/science [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [API] Blocking /api/v9/science [API] Blocking /api/v9/science [API] Blocking /api/v9/science [113024:0330/195355.956530:ERROR:shared_image_manager.cc(202)] SharedImageManager::ProduceSkia: Trying to Produce a Skia representation from a non-existent mailbox. [WIN] Electron event: maximize [WIN] State changed to: {"width":1165.3333333333335,"height":877.3333333333333,"isMaximized":true} [113024:0330/195355.990956:ERROR:shared_image_manager.cc(202)] SharedImageManager::ProduceSkia: Trying to Produce a Skia representation from a non-existent mailbox. [113024:0330/195356.046906:ERROR:shared_image_manager.cc(202)] SharedImageManager::ProduceSkia: Trying to Produce a Skia representation from a non-existent mailbox. [113024:0330/195356.063261:ERROR:shared_image_manager.cc(202)] SharedImageManager::ProduceSkia: Trying to Produce a Skia representation from a non-existent mailbox. [113024:0330/195356.103819:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times! [113024:0330/195356.137316:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: BGRA_8888, share_between_threads: 0, gmb_type: shared_memory [API] Blocking /api/v9/science [API] Blocking /api/v9/science [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [PERM]: Permission denied for a request to media. [113024:0330/195405.347830:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195405.348298:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195405.388858:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195405.389106:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195405.584076:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195405.584560:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195405.606647:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195405.607645:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [API] Blocking /api/v9/science [API] Blocking /api/v9/science [113024:0330/195406.047942:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195406.048773:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195406.413930:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195406.415279:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195406.462446:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195406.463601:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [API] Blocking /api/v9/science [113024:0330/195406.557501:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195406.557964:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195406.595512:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195406.596878:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195407.035656:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195407.036702:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195407.252473:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195407.252724:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195407.288124:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195407.288481:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [API] Blocking /api/v9/science [113024:0330/195409.354082:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 2 times! [API] Blocking /api/v9/science [API] Blocking /api/v9/science [API] Blocking /api/v9/science [API] Blocking /api/v9/science [API] Blocking /api/v9/science [API] Blocking /api/v9/science [API] Blocking /api/v9/science [113024:0330/195420.889068:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 3 times! [113024:0330/195421.196727:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195421.199468:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [API] Blocking /api/v9/science [113024:0330/195422.053219:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195422.055452:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195422.113322:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195422.117082:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195422.323973:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195422.325605:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195422.326020:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RED_8, share_between_threads: 0, gmb_type: shared_memory [113024:0330/195422.326184:ERROR:shared_image_factory.cc(575)] Could not find SharedImageBackingFactory with params: usage: Gles2|Raster|DisplayRead|Scanout, format: RG_88, share_between_threads: 0, gmb_type: shared_memory [API] Blocking /api/v9/science [API] Blocking /api/v9/science [API] Blocking /api/v9/science [API] Blocking `/api/v9/science ```
Fxzzi commented 1 year ago

I also experience this when screensharing but I don't have any special setup. I've tried both Wayland (Hyprland) and x11 (bspwm) and my screenshares always have unwatchable framerates. My friend is able to count them.

I don't have a prime setup, just an RTX 3070 Desktop.

arazadaz commented 1 year ago

Might be an issue with Nvidia. I've seen a few things about them lacking dmabuf import support on Linux which creates a number of issues. I'm not an expert on this topic, but we may just have to wait for Nvidia to fix it on their end assuming Nvidia is the issue.

I will say however that my X11 performance was perfectly fine with the regular discord client. Never tried Webcord or the browser's screen share on X11 though. I don't use X11 anymore.

TheSunCat commented 1 year ago

I'm seeing no hardware acceleration on WebCord on my AMD Wayland system, and this causes issues with video playback and screensharing performance (as well as increased power usage when WebCord is open/focused). I reported this in #300 but my understanding is that this can't be solved by WebCord itself. I've experimented with adding the flags that get Chromium to have acceleration in the optimize.ts snippet shared and compiling WebCord, but had no success.

SpacingBat3 commented 1 year ago

I've experimented with adding the flags that get Chromium to have acceleration in the optimize.ts snippet shared and compiling WebCord, but had no success.

LOL you can just execute WebCord with these flags, there's no need to recompile and repackage WebCord just to test it.


I'm also closing this, as @TheSunCat said if you can't get hardware acceleration, there's no way for me to magically enable it for you, it's Chromium's fault not mine. There's a lot you can experiment with (flags, different drivers and Electron version), but you should be aware it won't be easy. WebCord tries in optimize.ts to use some known flags which might help to get hardware acceleration working (especially on Linux), but it does not guarantee this will work out-of-the-box on any GPU. This is not a bug, but rather a limitation of the engine.

TheSunCat commented 1 year ago

Oh that's good to know! I might give it another go later if I don't have to recompile every time haha. If I do get it working, I'll post the flags I used here.

Amdarin commented 6 months ago

Dear all

I don't know if this is a error Knowledge or not but I have this issue on performance in the last release in debian 12. I tried with discord and it works better than it. I want use webcord because full screen sharing in wayland is fully supported but the performance on it is awful, too much laggy. Could I help on it sending logs or similar? I downgrade two previous release even the colleage has indicated v4.6.1 and this one works a little bit better but not optimus.