Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
739 stars 185 forks source link

[BUG]: OnFrameCaptured takes 15ms in render thread #841

Closed mdodis closed 1 year ago

mdodis commented 1 year ago

Package version

3.0.0-pre.1

Environment

* OS: Windows 10
* Unity version: 2021.3.11f1

Steps To Reproduce

  1. Produce a 3664x1920 render texture every frame (in my case, it's a stereo texture)
  2. Use Video Streamer from Unity Render Streaming (latest version)
  3. Max framerate: 72

Current Behavior

By looking at the profiler, the render thread spends a lot of time on OnFrameCaptured, as mentioned in a previosuly closed issue. In my measurements it was ~15ms, which can take our previously native 72 FPS down to 30 FPS. And that it is with a very simple VR scene (2 cubes and a cylinder only)

Expected Behavior

Closer to native 72 FPS while streaming (with a smaller overhead at least). I don't think OnFrameCaptured should be taking that long given the circumstances.

Anything else?

No response

karasusan commented 1 year ago

We already have had same issues here. https://github.com/Unity-Technologies/com.unity.webrtc/issues/803

mdodis commented 1 year ago

Duplicate of #803

karasusan commented 1 year ago

@mdodis Please post the comment into #803 if you have another opinion about the performance issue. Thank you.