keijiro / KlakNDI

NDI® plugin for Unity

Home Page:https://ndi.video

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AsyncGPUReadback.RequestIntoNativeArray leads to video stuttering

Exxenoz opened this issue · comments

Hi Keijiro! I'm working on a project where a video with a resolution of up to 16k is being played using the "AVPro Video" plugin. Multiple Unity cameras render different areas of this video into textures, which are then streamed using multiple NdiSender components.

The problem is that the video starts stuttering with more than 4 NdiSender components (all streaming 1920x1080p textures), despite having very powerful hardware. These stutters do not appear in the Unity Profiler as well. If the resolution of the textures is reduced, the stutters no longer occur, but unfortunately, this is not a long-term solution for us because we require high-quality NDI streams. I've narrowed down the issue to calls of AsyncGPUReadback.RequestIntoNativeArray. If you remove line 80 in NdiSender.cs, the video runs smoothly even with multiple enabled 4k NdiSender components, but of course, the NDI streams no longer function.

Here is a link to a minimal test setup in Unity (2022.2.19f1) so that you can reproduce the problem: https://mega.nz/file/PN5HQaja#dVB4HGrn-Mroceajyip-c38Xs1FXNaZISXMcWfzt4l4

  1. Open the project in Unity and create a release build using the Player Window.
  2. Open the folder where the binary is located and create a text file named "VideoPath.txt," where you write the absolute path of the video file (e.g. C:/Videos/Test.mp4). Ideally, use a video where objects move quickly, as it's easiest to spot the stutters based on fast movements. If you can't find a suitable video to reproduce the stutters, I can also send you one of our videos via email.
  3. Start the rvtdemo-video-stuttering-example.exe.

Thanks for your time & best regards
Andreas

Could you provide the information about the hardware specifications?

Could you provide the information about the hardware specifications?

Hi Keijiro, we are using the following Nvidia GPUs on our test systems:

  • P4000
  • RTX A2000
  • RTX 3070