MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
423 stars 51 forks source link

D3D11VideoDecoder performs better that VDAVideoDecoder #3751

Open cvalerio opened 10 months ago

cvalerio commented 10 months ago

Description In Windows, when playing mp4 videos in <video> element, WebView2 (in MAUI app) is using VDAVideoDecoder which seems to perform worse than D3D11VideoDecoder that is used in other Chromium projects, like Chrome or Electron. This impacts especially players app running on low end devices, such as Intel NUC kits. We measured GPU performances and it seems to be 1.5+ times, comparing VDAVideoDecoder to D3D11VideoDecoder, with average GPU usage measured in ~70% versus ~40% for an Electron app. Used GPU was an Intel Graphics HD 500. Also video playback is stuttering, when for example moving the mouse or when other small background tasks are performed, which did not happen in a comparable Electron application playing the same video file.

Version SDK: 7 Runtime: 116.0.1938.62 Framework: MAUI OS: Win10

Regression Was this working before but has regressed? no

Repro Steps Create a simple MAUI app playing a MP4 video file. The video should play smoothly, instead it stutters and high GPU usage is reported in performance monitor.

LiangTheDev commented 10 months ago

@cvalerio, when playing the video in Edge browser, does it work better or the same as in WebView2? And just to rule other things out, are you playing the video file from local file in the app or from some web server? There are some issues (not about performance, but who knows) when playing local files using WebView2's virtual host mapping, which MAUI might be using internally.

LiangTheDev commented 10 months ago

We will look into this. Just to collect some info, do you know which codec is the mp4 file using?

cvalerio commented 9 months ago

@LiangTheDev sorry for the late response, I was out for few days. Thanks very much for taking this in consideration.

Edge browser shows roughly the same performances while playing the same video from a local file. In MAUI app the video is served via a local web server, since I also had issues playing directly from local file.

I specifically measured only the Video Decode and Video Rendering GPU usage, trying to rule out every other metrics that can be affected by other things, like MAUI background routines or stuff like that.

Please find all the video data in attached file. Comparable measurements results have been done also with other videos (smaller/larger resolution, bitrate, etc...), given the obvious K multiplier coming from the difference in video size.

The stuttering in playback I mentioned is noticeable on lower end devices, of course, but the difference in CPU usage is measurable on higher end devices too, like my Surface pc.

HTH.

video-data.txt