librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

Performance drop when stop and restart streaming using playpause prefab in unity example

Open wodndb opened this issue 7 years ago • 4 comments

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

Imgur This is prefab to start and stop streaming in Unity Example (PointCloudProcessingBlocks.unity).

Profiler before stop streaming, Imgur

Profilter after Stop and resrart streaming using PlayPause prefab. Imgur

Performace dropped.

wodndb avatar Apr 19 '19 02:04 wodndb

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. Log

wodndb avatar Apr 19 '19 02:04 wodndb

RsConfiguration.Profiles in RsDevice.cs

Log2

wodndb avatar Apr 19 '19 02:04 wodndb

// 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.

wodndb avatar Apr 19 '19 03:04 wodndb

My code works well.

wodndb avatar Apr 19 '19 06:04 wodndb