Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

Question How to stop Render Thread invoking OnFrameCaptured after Stop is called from Signaling Manager?

Discussion in 'Unity Render Streaming' started by aibarredo, Jul 4, 2023.

  1. aibarredo

    aibarredo

    Joined:
    Jun 15, 2018
    Posts:
    4
    I made a UnityXR project for standalone 6DoF VR devices that makes use of modified versions of the Render Streaming samples and when I call SignalingManager.Run to send H264 video the framerate drops from 72fps to 60fps which is understandable. But when I call SignalingManager.Stop the framerate still remains at 60fps even when it doesn't send any video to a P2P-connected client.

    When I check the profiler I noticed that the UnityVideoTrackSource.OnFrameCaptured is still being invoked in the Render Thread at the end of frame and is giving my Main Thread an extra 7ms to wait.

    Is there any way I can stop this? Should I have called a function to dispose something?
     
  2. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    762
    Hi, can you share the screenshot of the profiler?

    FYI, I am working on improving performance here.
    https://github.com/Unity-Technologies/com.unity.webrtc/pull/924
     
  3. aibarredo

    aibarredo

    Joined:
    Jun 15, 2018
    Posts:
    4
    20230704_renderstream_profiler.png

    See attached image for reference. Note this was recorded from an Android device (PICO 4) connected to the local network.
     
  4. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    762
    Thank you for sharing the screenshot.
    I am checking the implementation of "SignalingManager.Stop".
     
    aibarredo likes this.