From f6482a4657471804abcf26aab95f5de8b3cff98f Mon Sep 17 00:00:00 2001 From: Nir Azkiel Date: Wed, 17 Apr 2024 21:37:03 +0300 Subject: [PATCH 1/2] reverse order of sensor open --- src/pipeline/resolver.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pipeline/resolver.h b/src/pipeline/resolver.h index b5a6b58721..6208869456 100644 --- a/src/pipeline/resolver.h +++ b/src/pipeline/resolver.h @@ -136,9 +136,10 @@ namespace librealsense void open() { - for (auto && kvp : _dev_to_profiles) { - auto&& sub = _results.at(kvp.first); - sub->open(kvp.second); + std::map::reverse_iterator it; + for (it = _dev_to_profiles.rbegin(); it != _dev_to_profiles.rend(); it++) { + auto&& sub = _results.at(it->first); + sub->open(it->second); } } From ea2f45bb996d121ed658f6adfc091e37d633fbd2 Mon Sep 17 00:00:00 2001 From: Nir Azkiel Date: Tue, 7 May 2024 09:31:26 +0300 Subject: [PATCH 2/2] UT updates and comment added --- src/pipeline/resolver.h | 15 +++++++++++---- .../live/frames/test-pipeline-start-stop.py | 5 +++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/pipeline/resolver.h b/src/pipeline/resolver.h index 6208869456..9a3e753935 100644 --- a/src/pipeline/resolver.h +++ b/src/pipeline/resolver.h @@ -136,10 +136,17 @@ namespace librealsense void open() { - std::map::reverse_iterator it; - for (it = _dev_to_profiles.rbegin(); it != _dev_to_profiles.rend(); it++) { - auto&& sub = _results.at(it->first); - sub->open(it->second); + // Camera has a limitation such that opening the color sensor after the + // depth sensor may cause the depth sensor a reset. + // This artifact may cause unexpected behavior when we ask to stop the sensor in parallel or control it + // while it is doing a reset. + // As a workaround for pipeline API usage, we use the assumption that depth sensor is first in the map if it is added to the configuration, + // When we reverse iterate it, the depth sensor opening will be last This should not affect other stream + // which are capable of being opened decoupled from other sensors + for( auto it = _dev_to_profiles.rbegin(); it != _dev_to_profiles.rend(); it++ ) + { + auto && sub = _results.at( it->first ); + sub->open( it->second ); } } diff --git a/unit-tests/live/frames/test-pipeline-start-stop.py b/unit-tests/live/frames/test-pipeline-start-stop.py index 897766149f..0dc06fa4e7 100644 --- a/unit-tests/live/frames/test-pipeline-start-stop.py +++ b/unit-tests/live/frames/test-pipeline-start-stop.py @@ -1,6 +1,7 @@ # License: Apache 2.0. See LICENSE file in root directory. -# Copyright(c) 2023 Intel Corporation. All Rights Reserved. +# Copyright(c) 2023-2024 Intel Corporation. All Rights Reserved. +# test:donotrun:!nightly # Currently, we exclude D457 as it's failing # test:device each(D400*) !D457 @@ -10,7 +11,7 @@ import time # Run multiple start stop of all streams and verify we get a frame for each once -ITERATIONS_COUNT = 2 +ITERATIONS_COUNT = 50 dev = test.find_first_device_or_exit()