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

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?

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

9122635--1265992--20230704_renderstream_profiler.png

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

Thank you for sharing the screenshot.
I am checking the implementation of “SignalingManager.Stop”.

1 Like