-
-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Describe the bug
Using VideoDesktopSource.setFrameRate to 30 or above only produces a frame every 32ms (ie. 30fps).
Setting it to a lower value than 30 does work as expected.
I'm not even going over the network at this stage, just using a LocalSink.
To Reproduce
Steps to reproduce the behavior:
- Use WindowCapturer to list windows / desktopsources.
- Select a window
- Setup a VideoDesktopSource with that window id and
setFrameRate(60 or 120)
factory.createVideoTrack(videoDesktopSource)
videoTrack.addSink(localSink)
- Measure time between frames in localSink
Expected behavior
Since I'm testing on Windows and DXGI should be used, the requested framerate should be respected and it's currently not the case.
Desktop (please complete the following information):
- OS: Windows 10
Additional context
The framerate I observe is very regular so it seems highly unlikely that this issue is the result of resource starvation.
Didn't see any relevant information even with webrtc Logging enabled.
It could be a limitation of using a localSink but I didn't see anything pointing that way. Also, since the framerate can be set to less than 30 and the localsink honors it, it doesn't seem to be the problem. Plus, using a localsink seems to be a "normal" testing thing for webrtc, from what I gathered.
At first glance, webrtc-java only uses the framerate to sleep the appropriate amout of time between frames.
So it looks like the issue is internal to webrtc or a limitation from windows capture API.
I looked at https://chromium.googlesource.com/external/webrtc/+/branch-heads/4844/modules/desktop_capture/
Didn't find anything pointing toward a webrtc limitation but I could have missed it.
But on Windows, DXGI should be used and from what I understand it should be fast enough for way more than 30fps.
I wasn't able to ascertain what was the capture API used.
I'm kinda hoping it's using a fallback (GDI ? ) instead of DXGI and that's the issue but this is a wild guess.