librealsense
librealsense copied to clipboard
Performance drop when stop and restart streaming using playpause prefab in unity example
| Required Info | |
|---|---|
| Camera Model | D415 |
| Firmware Version | 05.11.01.00 |
| Operating System & Version | Win10 |
| Platform | PC |
| SDK Version | 2.19.0 |
| Language | C#/unity |
| Segment | Image processing |
This is prefab to start and stop streaming in Unity Example (PointCloudProcessingBlocks.unity).
Profiler before stop streaming,

Profilter after Stop and resrart streaming using PlayPause prefab.

Performace dropped.
First I set color and depth frame size to 640 * 480.
After pause and play using pausePlay prefab, color and depth frame size is changed to 1280 * 720.
RsConfiguration.Profiles in RsDevice.cs

// RsDevice.cs
void OnEnable()
{
m_pipeline = new Pipeline();
Debug.Log("[0]" + DeviceConfiguration.Profiles[0].Width + ", " + DeviceConfiguration.Profiles[0].Height);
Debug.Log("[1]" + DeviceConfiguration.Profiles[1].Width + ", " + DeviceConfiguration.Profiles[1].Height);
Debug.Log("[2]" + DeviceConfiguration.Profiles[2].Width + ", " + DeviceConfiguration.Profiles[2].Height);
using (var cfg = DeviceConfiguration.ToPipelineConfig())
ActiveProfile = m_pipeline.Start(cfg);
// using (var activeStreams = ActiveProfile.Streams)
// DeviceConfiguration.Profiles = activeStreams.Select(RsVideoStreamRequest.FromProfile).ToArray();
if (processMode == ProcessMode.Multithread)
{
stopEvent.Reset();
worker = new Thread(WaitForFrames);
worker.IsBackground = true;
worker.Start();
}
StartCoroutine(WaitAndStart());
}
I think that ActiveProfile.Streams has empty profiles.
My code works well.