Skip to content

[Problem/Bug]: Screensharing a specific window will only stream at ~5 FPS #4176

Description

@SpikeHD

What happened?

Admittedly, I do not have a good reproducible example, as my project is:

  1. Indirectly using WebView2 (via Tauri)
  2. Using it to display an external website, not my own. (Discord, in case that is relevant)

I apologize :(

Regardless, this is a problem I've debugged pretty heavily, and it's come down to this:

  1. Firefox window and desktop streaming works fine. Hits the target FPS (~30) and bitrate is fine. Webcam streaming also works fine.
  2. Chrome streaming has a similar (if not, the same) issue. FPS is a consistent ~5 FPS, but the bitrate is fine. Webcam streaming starts poorly but becomes fine over about 10 seconds, almost on par with Firefox.
  3. WebView2 streaming is almost identical to Chrome. When streaming a window, FPS is ~5. When streaming a whole desktop, FPS is around the target (~30). Webcam is also the same (starts poorly, gets better). Bitrate is also fine in all instances.

A couple other notes:

  • The codecs used in all cases was H.264. I do not believe I can easily force something like VP9, if at all.
  • A similar issue already existed, describing not quite the same thing, but similar. It was closed, but can be found at mediaDevices.getDisplayMedia captured desktop video low frameRate issue #2905
  • Streaming locally, eg. from my WebView2 app, and viewing that stream locally (eg. through another browser) seems to be fine? Unsure if that was just a fluke of testing.
  • I use a weird setup that uses the iGPU for one monitor, and my 3070 for the other. I do not believe this impacts the issue though, as I am told others (presumably without the same wonky setup) also experience the same issue.
  • From my searching, this may be a Chromium bug, but I am not in the browser engine space enough to know why, how, or what could be done about that on my or Microsoft's end. Any guidance for further debugging would be appreciated!

Something must be up with window capturing. Electron doesn't seem to struggle with this, so perhaps they have made some change in the screen sharing system that fixes this.

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

119.0.2151.58

SDK Version

WebView2Utilities crashes when refreshing the host app tab

Framework

Other

Operating System

Windows 10

OS Version

Windows 10 22H2 19045.3693

Repro steps

  1. In a WV2 application, create a WebRTC video stream and stream a window of an application.
    1.1 Specifically a window. Full desktop streaming, and webcam streaming, both seem to work fine.
  2. On another internet connection/device, view the video stream. The bitrate should be fine, but the framerate quite poor.

The way I do this is via Discord. To get my above information, I started a new stream with some window, then had a friend view it, and relay the different statuses (FPS, bitrate) of the streams while I restarted the streams using different browsers.

Regression

No, this never worked

Last working version (if regression)

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions