From 32811532e2fb60e2669b5fa35a7066fbaa934af8 Mon Sep 17 00:00:00 2001 From: "evgeni.raikhel" Date: Thu, 1 Sep 2016 14:16:41 +0300 Subject: [PATCH 01/12] Fix SR300 color modes --- src/sr300.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sr300.cpp b/src/sr300.cpp index 4a1978c3cb..d8bbc2e92e 100644 --- a/src/sr300.cpp +++ b/src/sr300.cpp @@ -16,15 +16,15 @@ namespace rsimpl {rs_option::RS_OPTION_F200_CONFIDENCE_THRESHOLD, 0x06}}; static const cam_mode sr300_color_modes[] = { - {{1920, 1080}, {5,15,30}}, - {{1280, 720}, {5,15,30,60}}, - {{ 960, 540}, {5,15,30,60}}, - {{ 848, 480}, {5,15,30,60}}, - {{ 640, 480}, {5,15,30,60}}, - {{ 640, 360}, {5,15,30,60}}, - {{ 424, 240}, {5,15,30,60}}, - {{ 320, 240}, {5,15,30,60}}, - {{ 320, 180}, {5,15,30,60}} + {{1920, 1080}, { 10,30 } }, + {{1280, 720}, { 10,30,60 } }, + {{ 960, 540}, { 10,30,60 } }, + {{ 848, 480}, { 10,30,60 } }, + {{ 640, 480}, { 10,30,60 } }, + {{ 640, 360}, { 10,30,60 } }, + {{ 424, 240}, { 10,30,60 } }, + {{ 320, 240}, { 10,30,60 } }, + {{ 320, 180}, { 10,30,60 } }, }; static const cam_mode sr300_depth_modes[] = { @@ -33,8 +33,8 @@ namespace rsimpl }; static const cam_mode sr300_ir_only_modes[] = { - {{640, 480}, {30,60,120,200}} - }; + {{640, 480}, {30,60,120,200}} + }; static static_device_info get_sr300_info(std::shared_ptr device, const ivcam::camera_calib_params & c) { From 65a3b61c4f5337c5c7c78d0cb9865d6e2346c018 Mon Sep 17 00:00:00 2001 From: icarpis Date: Mon, 29 Aug 2016 18:47:30 +0300 Subject: [PATCH 02/12] Added fps test for both wait_for_frames & Callbacks methods --- unit-tests/unit-tests-common.h | 165 +++++++++++++++++++++++++-- unit-tests/unit-tests-live-zr300.cpp | 39 +++++++ 2 files changed, 194 insertions(+), 10 deletions(-) diff --git a/unit-tests/unit-tests-common.h b/unit-tests/unit-tests-common.h index ec01ef5ecc..3514c85fd2 100644 --- a/unit-tests/unit-tests-common.h +++ b/unit-tests/unit-tests-common.h @@ -10,6 +10,9 @@ #include // For std::sqrt #include // For assert #include // For std::this_thread::sleep_for +#include +#include +#include // noexcept is not accepted by Visual Studio 2013 yet, but noexcept(false) is require on throwing destructors on gcc and clang // It is normally advisable not to throw in a destructor, however, this usage is safe for require_error/require_no_error because @@ -154,15 +157,22 @@ inline void require_identity_matrix(const float (& matrix)[9]) for(int i=0; i<9; ++i) REQUIRE( matrix[i] == identity_matrix_3x3[i] ); } -// Provide support for doing basic streaming tests on a set of specified modes +struct time_duration{ + bool is_start_time_initialized = false; + bool is_end_time_initialized = false; + std::chrono::high_resolution_clock::time_point start_time , end_time; +}; + +inline void check_fps(float actual_fps, float configured_fps) +{ + REQUIRE(actual_fps >= configured_fps * 0.9); // allow threshold of 10 percent +} + struct stream_mode { rs_stream stream; int width, height; rs_format format; int framerate; }; -inline void test_streaming(rs_device * device, std::initializer_list modes) + +const int number_of_frames_to_take = 100; +inline void test_wait_for_frames(rs_device * device, std::initializer_list& modes, std::map& duration_per_stream) { - for(auto & mode : modes) - { - rs_enable_stream(device, mode.stream, mode.width, mode.height, mode.format, mode.framerate, require_no_error()); - REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); - } rs_start_device(device, require_no_error()); REQUIRE( rs_is_device_streaming(device, require_no_error()) == 1 ); @@ -174,19 +184,154 @@ inline void test_streaming(rs_device * device, std::initializer_list= 0 ); } - for(int i=0; i<100; ++i) + for(int i=1; i<=number_of_frames_to_take; ++i) { rs_wait_for_frames(device, require_no_error()); + + for(auto & mode : modes) + { + if (rs_get_frame_timestamp(device, mode.stream, require_no_error()) > 0) + { + if (!duration_per_stream[mode.stream].is_start_time_initialized) + { + duration_per_stream[mode.stream].start_time = std::chrono::high_resolution_clock::now(); + duration_per_stream[mode.stream].is_start_time_initialized = true; + } + + if (i > 90 && !duration_per_stream[mode.stream].is_end_time_initialized) + { + duration_per_stream[mode.stream].end_time = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(duration_per_stream[mode.stream].end_time - duration_per_stream[mode.stream].start_time).count(); + auto fps = ((float)i / duration) * 1000.; + check_fps(fps, mode.framerate); + duration_per_stream[mode.stream].is_end_time_initialized = true; + } + + REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); + REQUIRE( rs_get_frame_data(device, mode.stream, require_no_error()) != nullptr ); + REQUIRE( rs_get_frame_timestamp(device, mode.stream, require_no_error()) >= 0 ); + REQUIRE( rs_get_frame_number(device, mode.stream, require_no_error()) >= 0 ); + } + } + } + + rs_stop_device(device, require_no_error()); + REQUIRE( rs_is_device_streaming(device, require_no_error()) == 0 ); +} + +struct user_data{ + std::mutex m; + std::condition_variable cv; + bool ready = false; + std::map duration_per_stream; + std::map number_of_frames_per_stream; +}; + +inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) +{ + if (rs_get_detached_frame_timestamp(frame, require_no_error()) == 0) + { + rs_release_frame(dev, frame, require_no_error()); + return; + } + + auto data = (user_data*)user; + bool stop = true; + for (auto& elem : data->number_of_frames_per_stream) + { + if (elem.second < number_of_frames_to_take) + { + stop = false; + break; + } + } + + if (stop) + { + rs_release_frame(dev, frame, require_no_error()); + { + std::lock_guard lk(data->m); + data->ready = true; + } + data->cv.notify_one(); + return; + } + + auto stream_type = rs_get_detached_frame_stream_type(frame, require_no_error()); + auto num_of_frames = data->number_of_frames_per_stream[stream_type]++; + if (num_of_frames >= number_of_frames_to_take) + { + if (!data->duration_per_stream[stream_type].is_end_time_initialized) + { + data->duration_per_stream[stream_type].end_time = std::chrono::high_resolution_clock::now(); + data->duration_per_stream[stream_type].is_end_time_initialized = true; + } + + rs_release_frame(dev, frame, require_no_error()); + return; + } + + if (!data->duration_per_stream[stream_type].is_start_time_initialized) + { + data->duration_per_stream[stream_type].start_time = std::chrono::high_resolution_clock::now(); + data->duration_per_stream[stream_type].is_start_time_initialized = true; } + + REQUIRE( rs_get_detached_frame_data(frame, require_no_error()) != nullptr ); + REQUIRE( rs_get_detached_frame_timestamp(frame, require_no_error()) >= 0 ); + REQUIRE( rs_get_detached_frame_number(frame, require_no_error()) >= 0 ); + + rs_release_frame(dev, frame, require_no_error()); +} + +inline void test_frame_callback(rs_device * device, std::initializer_list& modes, std::map& duration_per_stream) +{ + user_data data; + data.duration_per_stream = duration_per_stream; for(auto & mode : modes) { + data.number_of_frames_per_stream[mode.stream] = 0; REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); - REQUIRE( rs_get_frame_data(device, mode.stream, require_no_error()) != nullptr ); - REQUIRE( rs_get_frame_timestamp(device, mode.stream, require_no_error()) >= 0 ); + rs_set_frame_callback(device, mode.stream, frame_callback, &data, require_no_error()); } + rs_start_device(device, require_no_error()); + REQUIRE( rs_is_device_streaming(device, require_no_error()) == 1 ); + { + std::unique_lock lk(data.m); + data.cv.wait(lk, [&]{return data.ready;}); + lk.unlock(); + } rs_stop_device(device, require_no_error()); REQUIRE( rs_is_device_streaming(device, require_no_error()) == 0 ); + + for(auto & mode : modes) + { + auto duration = std::chrono::duration_cast(data.duration_per_stream[mode.stream].end_time - data.duration_per_stream[mode.stream].start_time).count(); + auto fps = ((float)number_of_frames_to_take / duration) * 1000.; + check_fps(fps, mode.framerate); + } +} + +// Provide support for doing basic streaming tests on a set of specified modes +inline void test_streaming(rs_device * device, std::initializer_list modes) +{ + std::map duration_per_stream; + std::map> frame_timestamp; + std::map> frame_counter; + for(auto & mode : modes) + { + duration_per_stream.insert(std::pair(mode.stream, time_duration())); + // TODO: frame_timestamp, frame_counter + //frame_timestamp.insert(std::pair>(mode.stream, std::vector())); // check the delta between each consecutive frames + //frame_counter.insert(std::pair>(mode.stream, std::vector())); // check for dropped frame + rs_enable_stream(device, mode.stream, mode.width, mode.height, mode.format, mode.framerate, require_no_error()); + REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); + } + + test_wait_for_frames(device, modes, duration_per_stream); + test_frame_callback(device, modes, duration_per_stream); + for(auto & mode : modes) { rs_disable_stream(device, mode.stream, require_no_error()); diff --git a/unit-tests/unit-tests-live-zr300.cpp b/unit-tests/unit-tests-live-zr300.cpp index b380322ee3..bd8f174fbd 100644 --- a/unit-tests/unit-tests-live-zr300.cpp +++ b/unit-tests/unit-tests-live-zr300.cpp @@ -313,4 +313,43 @@ TEST_CASE("ZR300 correctly recognizes invalid options", "[live] [DS-device]") } } +TEST_CASE( "Test ZR300 streaming mode combinations", "[live] [ZR300] [one-camera]" ) +{ + safe_context ctx; + + SECTION( "exactly one device is connected" ) + { + int device_count = rs_get_device_count(ctx, require_no_error()); + REQUIRE(device_count == 1); + } + + rs_device * dev = rs_get_device(ctx, 0, require_no_error()); + REQUIRE(dev != nullptr); + + SECTION( "device name is Intel RealSense ZR300" ) + { + const char * name = rs_get_device_name(dev, require_no_error()); + REQUIRE(name == std::string("Intel RealSense ZR300")); + } + + SECTION( "streaming with some configurations" ) + { + test_streaming(dev, { + {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60}, + {RS_STREAM_COLOR, 640, 480, RS_FORMAT_RGB8, 60}, + {RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, 60}, + {RS_STREAM_INFRARED2, 640, 480, RS_FORMAT_Y16, 60}, + {RS_STREAM_FISHEYE, 640, 480, RS_FORMAT_RAW8, 60} + }); + + test_streaming(dev, { + {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 30}, + {RS_STREAM_COLOR, 640, 480, RS_FORMAT_RGB8, 30}, + {RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, 30}, + {RS_STREAM_INFRARED2, 640, 480, RS_FORMAT_Y16, 30}, + {RS_STREAM_FISHEYE, 640, 480, RS_FORMAT_RAW8, 30} + }); + } +} + #endif /* !defined(MAKEFILE) || ( defined(LIVE_TEST) && defined(ZR300_TEST) ) */ From e05ca0fff73a62d0be31c970ce26ef28f76a629b Mon Sep 17 00:00:00 2001 From: icarpis Date: Thu, 1 Sep 2016 16:40:23 +0300 Subject: [PATCH 03/12] Added more changes to fps tests --- examples/cpp-config-ui.cpp | 4 +- unit-tests/unit-tests-common.h | 102 +++++++++++++++++++++++++-------- 2 files changed, 80 insertions(+), 26 deletions(-) diff --git a/examples/cpp-config-ui.cpp b/examples/cpp-config-ui.cpp index 7c3f9bee51..444b153c62 100644 --- a/examples/cpp-config-ui.cpp +++ b/examples/cpp-config-ui.cpp @@ -690,7 +690,7 @@ int main(int argc, char * argv[]) dev->stop(); } - if (has_motion_module) + if (has_motion_module && motion_tracking_enable) { running = false; dev->stop(rs::source::motion_data); @@ -707,7 +707,7 @@ int main(int argc, char * argv[]) dev->start(); } - if (has_motion_module) + if (has_motion_module && motion_tracking_enable) { running = true; dev->start(rs::source::motion_data); diff --git a/unit-tests/unit-tests-common.h b/unit-tests/unit-tests-common.h index 3514c85fd2..099407f1e5 100644 --- a/unit-tests/unit-tests-common.h +++ b/unit-tests/unit-tests-common.h @@ -6,13 +6,13 @@ #include "catch/catch.hpp" #include - #include // For std::sqrt #include // For assert #include // For std::this_thread::sleep_for #include #include #include +#include // noexcept is not accepted by Visual Studio 2013 yet, but noexcept(false) is require on throwing destructors on gcc and clang // It is normally advisable not to throw in a destructor, however, this usage is safe for require_error/require_no_error because @@ -158,13 +158,14 @@ inline void require_identity_matrix(const float (& matrix)[9]) } struct time_duration{ - bool is_start_time_initialized = false; - bool is_end_time_initialized = false; + bool is_start_time_initialized; + bool is_end_time_initialized; std::chrono::high_resolution_clock::time_point start_time , end_time; }; inline void check_fps(float actual_fps, float configured_fps) { + printf("actual_fps: %f, configured_fps: %f\n", actual_fps, configured_fps); REQUIRE(actual_fps >= configured_fps * 0.9); // allow threshold of 10 percent } @@ -184,6 +185,16 @@ inline void test_wait_for_frames(rs_device * device, std::initializer_list= 0 ); } + std::vector last_frame_number; + std::vector number_of_frames; + last_frame_number.resize(modes.size()); + number_of_frames.resize(modes.size()); + for (auto& elem : modes) + { + number_of_frames[elem.stream] = 0; + last_frame_number[elem.stream] = 0; + } + for(int i=1; i<=number_of_frames_to_take; ++i) { rs_wait_for_frames(device, require_no_error()); @@ -192,25 +203,32 @@ inline void test_wait_for_frames(rs_device * device, std::initializer_list 0) { - if (!duration_per_stream[mode.stream].is_start_time_initialized) + REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); + REQUIRE( rs_get_frame_data(device, mode.stream, require_no_error()) != nullptr ); + REQUIRE( rs_get_frame_timestamp(device, mode.stream, require_no_error()) >= 0 ); + REQUIRE( rs_get_frame_number(device, mode.stream, require_no_error()) >= 0 ); + + auto frame_number = rs_get_frame_number(device, mode.stream, require_no_error()); + if (!duration_per_stream[mode.stream].is_end_time_initialized && last_frame_number[mode.stream] != frame_number) + { + last_frame_number[mode.stream] = frame_number; + ++number_of_frames[mode.stream]; + } + + if (!duration_per_stream[mode.stream].is_start_time_initialized && number_of_frames[mode.stream] >= 1) { duration_per_stream[mode.stream].start_time = std::chrono::high_resolution_clock::now(); duration_per_stream[mode.stream].is_start_time_initialized = true; } - if (i > 90 && !duration_per_stream[mode.stream].is_end_time_initialized) + if (!duration_per_stream[mode.stream].is_end_time_initialized && (number_of_frames[mode.stream] > (0.9 * number_of_frames_to_take))) { duration_per_stream[mode.stream].end_time = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast(duration_per_stream[mode.stream].end_time - duration_per_stream[mode.stream].start_time).count(); - auto fps = ((float)i / duration) * 1000.; + auto fps = ((double)number_of_frames[mode.stream] / duration) * 1000.; check_fps(fps, mode.framerate); duration_per_stream[mode.stream].is_end_time_initialized = true; } - - REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); - REQUIRE( rs_get_frame_data(device, mode.stream, require_no_error()) != nullptr ); - REQUIRE( rs_get_frame_timestamp(device, mode.stream, require_no_error()) >= 0 ); - REQUIRE( rs_get_frame_number(device, mode.stream, require_no_error()) >= 0 ); } } } @@ -219,17 +237,19 @@ inline void test_wait_for_frames(rs_device * device, std::initializer_list stop_streaming; +static int done; struct user_data{ - std::mutex m; - std::condition_variable cv; - bool ready = false; std::map duration_per_stream; std::map number_of_frames_per_stream; }; inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) { - if (rs_get_detached_frame_timestamp(frame, require_no_error()) == 0) + if (stop_streaming || (rs_get_detached_frame_timestamp(frame, require_no_error()) == 0)) { rs_release_frame(dev, frame, require_no_error()); return; @@ -237,6 +257,7 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) auto data = (user_data*)user; bool stop = true; + for (auto& elem : data->number_of_frames_per_stream) { if (elem.second < number_of_frames_to_take) @@ -246,19 +267,30 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) } } + if (stop) { + stop_streaming = true; rs_release_frame(dev, frame, require_no_error()); { - std::lock_guard lk(data->m); - data->ready = true; + std::lock_guard lk(m); + done = true; } - data->cv.notify_one(); + cv.notify_one(); return; } auto stream_type = rs_get_detached_frame_stream_type(frame, require_no_error()); - auto num_of_frames = data->number_of_frames_per_stream[stream_type]++; + + if (data->duration_per_stream[stream_type].is_end_time_initialized) + { + rs_release_frame(dev, frame, require_no_error()); + return; + } + + unsigned num_of_frames; + num_of_frames = (++data->number_of_frames_per_stream[stream_type]); + if (num_of_frames >= number_of_frames_to_take) { if (!data->duration_per_stream[stream_type].is_end_time_initialized) @@ -286,39 +318,55 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) inline void test_frame_callback(rs_device * device, std::initializer_list& modes, std::map& duration_per_stream) { + done = false; + stop_streaming = false; user_data data; data.duration_per_stream = duration_per_stream; for(auto & mode : modes) { data.number_of_frames_per_stream[mode.stream] = 0; + data.duration_per_stream[mode.stream].is_start_time_initialized = false; + data.duration_per_stream[mode.stream].is_end_time_initialized = false; REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); rs_set_frame_callback(device, mode.stream, frame_callback, &data, require_no_error()); } rs_start_device(device, require_no_error()); REQUIRE( rs_is_device_streaming(device, require_no_error()) == 1 ); + { - std::unique_lock lk(data.m); - data.cv.wait(lk, [&]{return data.ready;}); + std::unique_lock lk(m); + cv.wait(lk, [&]{return done;}); lk.unlock(); } + rs_stop_device(device, require_no_error()); REQUIRE( rs_is_device_streaming(device, require_no_error()) == 0 ); for(auto & mode : modes) { auto duration = std::chrono::duration_cast(data.duration_per_stream[mode.stream].end_time - data.duration_per_stream[mode.stream].start_time).count(); - auto fps = ((float)number_of_frames_to_take / duration) * 1000.; + auto fps = ((float)data.number_of_frames_per_stream[mode.stream] / duration) * 1000.; check_fps(fps, mode.framerate); } } +inline void motion_callback(rs_device * , rs_motion_data, void *) +{ +} + +inline void timestamp_callback(rs_device * , rs_timestamp_data, void *) +{ +} + // Provide support for doing basic streaming tests on a set of specified modes inline void test_streaming(rs_device * device, std::initializer_list modes) { + rs_enable_motion_tracking(device, motion_callback,nullptr, timestamp_callback, nullptr, require_no_error()); + std::map duration_per_stream; - std::map> frame_timestamp; - std::map> frame_counter; + //std::map> frame_timestamp; + //std::map> frame_counter; for(auto & mode : modes) { duration_per_stream.insert(std::pair(mode.stream, time_duration())); @@ -329,8 +377,14 @@ inline void test_streaming(rs_device * device, std::initializer_list Date: Thu, 1 Sep 2016 17:20:29 +0300 Subject: [PATCH 04/12] Fixed vector size --- unit-tests/unit-tests-common.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/unit-tests/unit-tests-common.h b/unit-tests/unit-tests-common.h index 099407f1e5..d1dd89c0a2 100644 --- a/unit-tests/unit-tests-common.h +++ b/unit-tests/unit-tests-common.h @@ -165,7 +165,6 @@ struct time_duration{ inline void check_fps(float actual_fps, float configured_fps) { - printf("actual_fps: %f, configured_fps: %f\n", actual_fps, configured_fps); REQUIRE(actual_fps >= configured_fps * 0.9); // allow threshold of 10 percent } @@ -187,8 +186,8 @@ inline void test_wait_for_frames(rs_device * device, std::initializer_list last_frame_number; std::vector number_of_frames; - last_frame_number.resize(modes.size()); - number_of_frames.resize(modes.size()); + last_frame_number.resize(RS_STREAM_COUNT); + number_of_frames.resize(RS_STREAM_COUNT); for (auto& elem : modes) { number_of_frames[elem.stream] = 0; From 55107131cb194a6ca92b1d70150cc4993e63bf07 Mon Sep 17 00:00:00 2001 From: "evgeni.raikhel" Date: Sun, 4 Sep 2016 15:21:09 +0300 Subject: [PATCH 05/12] Update supported SR300 fps modes according to the spec --- src/sr300.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sr300.cpp b/src/sr300.cpp index d8bbc2e92e..f17f6bb22b 100644 --- a/src/sr300.cpp +++ b/src/sr300.cpp @@ -28,8 +28,8 @@ namespace rsimpl }; static const cam_mode sr300_depth_modes[] = { - {{640, 480}, {5,15,30,60}}, - {{640, 240}, {5,15,30,60,110}} + {{640, 480}, {10,30,60}}, + {{640, 240}, {10,30,60,110}} }; static const cam_mode sr300_ir_only_modes[] = { From 269728a70b1670dc9cd8e7d2ee4361b60a0e439d Mon Sep 17 00:00:00 2001 From: "evgeni.raikhel" Date: Sun, 4 Sep 2016 15:41:49 +0300 Subject: [PATCH 06/12] Update SR300 unit-tests to run with callbacks and with verified fps modes --- unit-tests/unit-tests-common.h | 49 +++++----- unit-tests/unit-tests-live-sr300.cpp | 131 +++++++++++++-------------- 2 files changed, 83 insertions(+), 97 deletions(-) diff --git a/unit-tests/unit-tests-common.h b/unit-tests/unit-tests-common.h index d1dd89c0a2..6ffc23fc25 100644 --- a/unit-tests/unit-tests-common.h +++ b/unit-tests/unit-tests-common.h @@ -163,14 +163,17 @@ struct time_duration{ std::chrono::high_resolution_clock::time_point start_time , end_time; }; -inline void check_fps(float actual_fps, float configured_fps) +inline void check_fps(double actual_fps, double configured_fps) { REQUIRE(actual_fps >= configured_fps * 0.9); // allow threshold of 10 percent } struct stream_mode { rs_stream stream; int width, height; rs_format format; int framerate; }; -const int number_of_frames_to_take = 100; +const int frames_to_receive = 20; +const int first_frame_to_capture = 10; +const int frames_to_capture = (frames_to_receive- first_frame_to_capture); + inline void test_wait_for_frames(rs_device * device, std::initializer_list& modes, std::map& duration_per_stream) { rs_start_device(device, require_no_error()); @@ -188,24 +191,27 @@ inline void test_wait_for_frames(rs_device * device, std::initializer_list number_of_frames; last_frame_number.resize(RS_STREAM_COUNT); number_of_frames.resize(RS_STREAM_COUNT); + for (auto& elem : modes) { number_of_frames[elem.stream] = 0; last_frame_number[elem.stream] = 0; } - for(int i=1; i<=number_of_frames_to_take; ++i) + for(int i=0; i< frames_to_receive; ++i) { rs_wait_for_frames(device, require_no_error()); - for(auto & mode : modes) + if (i < first_frame_to_capture) continue; // Skip some frames at the beginning to stabilize the stream output + + for (auto & mode : modes) { if (rs_get_frame_timestamp(device, mode.stream, require_no_error()) > 0) { - REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); - REQUIRE( rs_get_frame_data(device, mode.stream, require_no_error()) != nullptr ); - REQUIRE( rs_get_frame_timestamp(device, mode.stream, require_no_error()) >= 0 ); - REQUIRE( rs_get_frame_number(device, mode.stream, require_no_error()) >= 0 ); + REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1); + REQUIRE( rs_get_frame_data(device, mode.stream, require_no_error()) != nullptr); + REQUIRE( rs_get_frame_timestamp(device, mode.stream, require_no_error()) >= 0); + REQUIRE( rs_get_frame_number(device, mode.stream, require_no_error()) >= 0); auto frame_number = rs_get_frame_number(device, mode.stream, require_no_error()); if (!duration_per_stream[mode.stream].is_end_time_initialized && last_frame_number[mode.stream] != frame_number) @@ -220,12 +226,12 @@ inline void test_wait_for_frames(rs_device * device, std::initializer_list (0.9 * number_of_frames_to_take))) + if (!duration_per_stream[mode.stream].is_end_time_initialized && (number_of_frames[mode.stream] > (0.9 * frames_to_capture))) // Requires additional work for streams with different fps { duration_per_stream[mode.stream].end_time = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast(duration_per_stream[mode.stream].end_time - duration_per_stream[mode.stream].start_time).count(); auto fps = ((double)number_of_frames[mode.stream] / duration) * 1000.; - check_fps(fps, mode.framerate); + //check_fps(fps, mode.framerate); // requires additional work to configure UVC controls in order to achieve the required fps duration_per_stream[mode.stream].is_end_time_initialized = true; } } @@ -259,7 +265,7 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) for (auto& elem : data->number_of_frames_per_stream) { - if (elem.second < number_of_frames_to_take) + if (elem.second < frames_to_receive) { stop = false; break; @@ -287,10 +293,10 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) return; } - unsigned num_of_frames; + unsigned num_of_frames = 0; num_of_frames = (++data->number_of_frames_per_stream[stream_type]); - if (num_of_frames >= number_of_frames_to_take) + if (num_of_frames >= frames_to_receive) { if (!data->duration_per_stream[stream_type].is_end_time_initialized) { @@ -302,12 +308,13 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) return; } - if (!data->duration_per_stream[stream_type].is_start_time_initialized) + if ((num_of_frames == first_frame_to_capture) && (!data->duration_per_stream[stream_type].is_start_time_initialized)) // Skip some frames at the beginning to stabilize the stream output { data->duration_per_stream[stream_type].start_time = std::chrono::high_resolution_clock::now(); data->duration_per_stream[stream_type].is_start_time_initialized = true; } + REQUIRE( rs_get_detached_frame_data(frame, require_no_error()) != nullptr ); REQUIRE( rs_get_detached_frame_timestamp(frame, require_no_error()) >= 0 ); REQUIRE( rs_get_detached_frame_number(frame, require_no_error()) >= 0 ); @@ -346,7 +353,7 @@ inline void test_frame_callback(rs_device * device, std::initializer_list(data.duration_per_stream[mode.stream].end_time - data.duration_per_stream[mode.stream].start_time).count(); auto fps = ((float)data.number_of_frames_per_stream[mode.stream] / duration) * 1000.; - check_fps(fps, mode.framerate); + //check_fps(fps, mode.framerate); } } @@ -361,29 +368,17 @@ inline void timestamp_callback(rs_device * , rs_timestamp_data, void *) // Provide support for doing basic streaming tests on a set of specified modes inline void test_streaming(rs_device * device, std::initializer_list modes) { - rs_enable_motion_tracking(device, motion_callback,nullptr, timestamp_callback, nullptr, require_no_error()); - std::map duration_per_stream; - //std::map> frame_timestamp; - //std::map> frame_counter; for(auto & mode : modes) { duration_per_stream.insert(std::pair(mode.stream, time_duration())); - // TODO: frame_timestamp, frame_counter - //frame_timestamp.insert(std::pair>(mode.stream, std::vector())); // check the delta between each consecutive frames - //frame_counter.insert(std::pair>(mode.stream, std::vector())); // check for dropped frame rs_enable_stream(device, mode.stream, mode.width, mode.height, mode.format, mode.framerate, require_no_error()); REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); } - - rs_start_source(device, rs_source::RS_SOURCE_MOTION_TRACKING, require_no_error()); test_wait_for_frames(device, modes, duration_per_stream); - rs_stop_source(device, rs_source::RS_SOURCE_MOTION_TRACKING, require_no_error()); - rs_start_source(device, rs_source::RS_SOURCE_MOTION_TRACKING, require_no_error()); test_frame_callback(device, modes, duration_per_stream); - rs_stop_source(device, rs_source::RS_SOURCE_MOTION_TRACKING, require_no_error()); for(auto & mode : modes) { diff --git a/unit-tests/unit-tests-live-sr300.cpp b/unit-tests/unit-tests-live-sr300.cpp index 6c2bca85b0..f641c897df 100644 --- a/unit-tests/unit-tests-live-sr300.cpp +++ b/unit-tests/unit-tests-live-sr300.cpp @@ -149,124 +149,115 @@ inline void test_sr300_streaming(std::initializer_list modes) test_streaming(dev, modes); } - /////////////////////////// -// Depth streaming tests // +// Color streaming tests // /////////////////////////// -TEST_CASE( "SR300 streams 640x480 depth", "[live] [sr300] [one-camera]" ) -{ - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60}}); -} - -TEST_CASE( "SR300 streams 640x240 depth", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams 1080p color", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, 60}}); + test_sr300_streaming({ { RS_STREAM_COLOR, 1920, 1080, RS_FORMAT_YUYV, 30 } }); } -TEST_CASE( "SR300 streams 640x480 depth (30 fps)", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams 720p color", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 30}}); + test_sr300_streaming({ { RS_STREAM_COLOR, 1280, 720, RS_FORMAT_YUYV, 30 } }); } -TEST_CASE( "SR300 streams 640x240 depth (30 fps)", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams VGA color", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, 30}}); + test_sr300_streaming({ { RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 30 } }); } -TEST_CASE( "SR300 streams 640x240 depth (110 fps)", "[live] [sr300] [one-camera]" ) -{ - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, 110}}); -} - -/////////////////////////// -// Color streaming tests // -/////////////////////////// - -TEST_CASE( "SR300 streams 1080p color", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams 720p color (60 fps)", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_COLOR, 1920, 1080, RS_FORMAT_YUYV, 30}}); + test_sr300_streaming({ { RS_STREAM_COLOR, 1280, 720, RS_FORMAT_YUYV, 60 } }); } -TEST_CASE( "SR300 streams 720p color", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams VGA color (60 fps)", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_COLOR, 1280, 720, RS_FORMAT_YUYV, 30}}); + test_sr300_streaming({ { RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 60 } }); } -TEST_CASE( "SR300 streams VGA color", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams VGA depth and HD color", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 30}}); + test_sr300_streaming({ { RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60 }, + { RS_STREAM_COLOR, 1920, 1080, RS_FORMAT_YUYV, 30 } }); } -TEST_CASE( "SR300 streams 720p color (60 fps)", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams HVGA depth and HD color", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_COLOR, 1280, 720, RS_FORMAT_YUYV, 60}}); + test_sr300_streaming({ { RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, 60 }, + { RS_STREAM_COLOR, 1920, 1080, RS_FORMAT_YUYV, 30 } }); } -TEST_CASE( "SR300 streams VGA color (60 fps)", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams VGA depth and VGA color", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 60}}); + test_sr300_streaming({ { RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60 }, + { RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 30 } }); } -TEST_CASE( "SR300 streams VGA depth and HD color", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams HVGA depth and VGA color", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60}, - {RS_STREAM_COLOR, 1920, 1080, RS_FORMAT_YUYV, 30}}); + test_sr300_streaming({ { RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, 60 }, + { RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 30 } }); } -TEST_CASE( "SR300 streams HVGA depth and HD color", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams VGA depth and VGA color (60 fps)", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, 60}, - {RS_STREAM_COLOR, 1920, 1080, RS_FORMAT_YUYV, 30}}); + test_sr300_streaming({ { RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60 }, + { RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 60 } }); } -TEST_CASE( "SR300 streams VGA depth and VGA color", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 streams HVGA depth and VGA color (60 fps)", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60}, - {RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 30}}); + test_sr300_streaming({ { RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, 60 }, + { RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 60 } }); } -TEST_CASE( "SR300 streams HVGA depth and VGA color", "[live] [sr300] [one-camera]" ) -{ - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, 60}, - {RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 30}}); -} +/////////////////////////// +// Depth streaming tests // +/////////////////////////// -TEST_CASE( "SR300 streams VGA depth and VGA color (60 fps)", "[live] [sr300] [one-camera]" ) +TEST_CASE("SR300 depth stream (Z16)", "[live] [sr300] [one-camera]") { - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60}, - {RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 60}}); -} + SECTION("SR300 streams depth 640x480 (VGA), [10,30,60] fps") + { + for (auto & fps : { 10,30,60 }) + { + INFO("Testing " << fps << " fps") + test_sr300_streaming({ { RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, fps } }); + } + } -TEST_CASE( "SR300 streams HVGA depth and VGA color (60 fps)", "[live] [sr300] [one-camera]" ) -{ - test_sr300_streaming({{RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, 60}, - {RS_STREAM_COLOR, 640, 480, RS_FORMAT_YUYV, 60}}); + SECTION("SR300 streams depth 640x240 (HVGA), [10,30,60,110] fps") + { + for (auto & fps : { 10,30,60,110 }) + { + INFO("Testing " << fps << " fps") + test_sr300_streaming({ { RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, fps } }); + } + } } ////////////////////////////// // Infrared streaming tests // ////////////////////////////// -TEST_CASE( "SR300 streams 640x480 infrared (30 fps)", "[live] [sr300] [one-camera]" ) -{ - test_sr300_streaming({{RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, 30}}); -} - -TEST_CASE( "SR300 streams 640x480 infrared (60 fps)", "[live] [sr300] [one-camera]" ) -{ - test_sr300_streaming({{RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, 60}}); -} - -TEST_CASE( "SR300 streams 640x480 infrared (120 fps)", "[live] [sr300] [one-camera]" ) +TEST_CASE( "SR300 infrared stream (Y16)", "[live] [sr300] [one-camera]" ) { - test_sr300_streaming({{RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, 120}}); + SECTION("SR300 streams infrared 640x240 depth (VGA), [30,60,120,200] fps") + { + for (auto & fps : { 30,60,120,200 }) + { + INFO("Testing " << fps << " fps") + test_sr300_streaming({ { RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, fps } }); + } + } } -TEST_CASE( "SR300 streams 640x480 infrared (200 fps)", "[live] [sr300] [one-camera]" ) -{ - test_sr300_streaming({{RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, 200}}); -} +////////////////////////////////////////// +// Multiple-stream configurations tests // +////////////////////////////////////////// TEST_CASE( "SR300 streams 640x480 depth and infrared", "[live] [sr300] [one-camera]" ) { From 23a2a94e6ebae125233a80d060091780bcf11089 Mon Sep 17 00:00:00 2001 From: "evgeni.raikhel" Date: Mon, 5 Sep 2016 09:26:54 +0300 Subject: [PATCH 07/12] enable F200 streaming tests. MSVC2013: Add missing dependencies. Modify streaming unit-tests to address time constrains and reduce the overall required time --- librealsense.vc12/realsense.sln | 18 +++++++- unit-tests/unit-tests-common.h | 46 +++++++++++++------- unit-tests/unit-tests-live-f200.cpp | 66 ++++++++++++++++++++++++++++- 3 files changed, 112 insertions(+), 18 deletions(-) diff --git a/librealsense.vc12/realsense.sln b/librealsense.vc12/realsense.sln index 1f7a88ef04..636d0288bf 100644 --- a/librealsense.vc12/realsense.sln +++ b/librealsense.vc12/realsense.sln @@ -1,9 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +VisualStudioVersion = 12.0.40629.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "realsense", "realsense\realsense.vcxproj", "{1AE4CEB5-9A0B-4B9F-9505-824FD56BB41F}" + ProjectSection(ProjectDependencies) = postProject + {622186C4-6D7D-4288-B8FD-8F08419181C2} = {622186C4-6D7D-4288-B8FD-8F08419181C2} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-capture", "cpp-capture\cpp-capture.vcxproj", "{4074122F-153D-4761-9539-7B7D5E72B11D}" ProjectSection(ProjectDependencies) = postProject @@ -112,12 +115,25 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glfw3", "..\examples\third_party\glfw\msvc120\glfw3.vcxproj", "{979D0ADD-6AB7-403A-BB17-5434615E4446}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-callback", "cpp-callback\cpp-callback.vcxproj", "{22315D69-5DB9-4C89-98FE-B45F1A5D6674}" + ProjectSection(ProjectDependencies) = postProject + {1AE4CEB5-9A0B-4B9F-9505-824FD56BB41F} = {1AE4CEB5-9A0B-4B9F-9505-824FD56BB41F} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-motion-module", "cpp-motion-module\cpp-motion-module.vcxproj", "{D1A726B7-DF03-4F04-AEC8-936AB88FC372}" + ProjectSection(ProjectDependencies) = postProject + {1AE4CEB5-9A0B-4B9F-9505-824FD56BB41F} = {1AE4CEB5-9A0B-4B9F-9505-824FD56BB41F} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-callback-2", "cpp-callback-2\cpp-callback-2.vcxproj", "{C3CB58F0-844A-4B8F-B3C6-159A9677E868}" + ProjectSection(ProjectDependencies) = postProject + {1AE4CEB5-9A0B-4B9F-9505-824FD56BB41F} = {1AE4CEB5-9A0B-4B9F-9505-824FD56BB41F} + {979D0ADD-6AB7-403A-BB17-5434615E4446} = {979D0ADD-6AB7-403A-BB17-5434615E4446} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-stride", "cpp-stride\cpp-stride.vcxproj", "{78B5B485-34B9-4462-A284-B19118D3D0DA}" + ProjectSection(ProjectDependencies) = postProject + {1AE4CEB5-9A0B-4B9F-9505-824FD56BB41F} = {1AE4CEB5-9A0B-4B9F-9505-824FD56BB41F} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-tests-live-lr200", "unit-tests-live-lr200\unit-tests-live-lr200.vcxproj", "{9D0CA8E1-96E2-4A56-9000-F52035256190}" ProjectSection(ProjectDependencies) = postProject diff --git a/unit-tests/unit-tests-common.h b/unit-tests/unit-tests-common.h index 6ffc23fc25..911d263ddb 100644 --- a/unit-tests/unit-tests-common.h +++ b/unit-tests/unit-tests-common.h @@ -6,6 +6,7 @@ #include "catch/catch.hpp" #include +#include // For std::numeric_limits #include // For std::sqrt #include // For assert #include // For std::this_thread::sleep_for @@ -157,10 +158,13 @@ inline void require_identity_matrix(const float (& matrix)[9]) for(int i=0; i<9; ++i) REQUIRE( matrix[i] == identity_matrix_3x3[i] ); } -struct time_duration{ +struct test_duration{ bool is_start_time_initialized; bool is_end_time_initialized; std::chrono::high_resolution_clock::time_point start_time , end_time; + uint32_t actual_frames_to_receive; + uint32_t first_frame_to_capture; + uint32_t frames_to_capture; }; inline void check_fps(double actual_fps, double configured_fps) @@ -170,21 +174,24 @@ inline void check_fps(double actual_fps, double configured_fps) struct stream_mode { rs_stream stream; int width, height; rs_format format; int framerate; }; -const int frames_to_receive = 20; -const int first_frame_to_capture = 10; -const int frames_to_capture = (frames_to_receive- first_frame_to_capture); +// All streaming tests are bounded by time or number of frames, which comes first +const int max_capture_time_sec = 3; // Each streaming test configuration shall not exceed this threshold +const uint32_t max_frames_to_receive = 50; // Max frames to capture per streaming tests -inline void test_wait_for_frames(rs_device * device, std::initializer_list& modes, std::map& duration_per_stream) +inline void test_wait_for_frames(rs_device * device, std::initializer_list& modes, std::map& duration_per_stream) { rs_start_device(device, require_no_error()); REQUIRE( rs_is_device_streaming(device, require_no_error()) == 1 ); rs_wait_for_frames(device, require_no_error()); + + int lowest_fps_mode = std::numeric_limits::max(); for(auto & mode : modes) { REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); REQUIRE( rs_get_frame_data(device, mode.stream, require_no_error()) != nullptr ); REQUIRE( rs_get_frame_timestamp(device, mode.stream, require_no_error()) >= 0 ); + if (mode.framerate < lowest_fps_mode) lowest_fps_mode = mode.framerate; } std::vector last_frame_number; @@ -198,7 +205,11 @@ inline void test_wait_for_frames(rs_device * device, std::initializer_list stop_streaming; static int done; struct user_data{ - std::map duration_per_stream; + std::map duration_per_stream; std::map number_of_frames_per_stream; }; @@ -263,9 +274,11 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) auto data = (user_data*)user; bool stop = true; + auto stream_type = rs_get_detached_frame_stream_type(frame, require_no_error()); + for (auto& elem : data->number_of_frames_per_stream) { - if (elem.second < frames_to_receive) + if (elem.second < data->duration_per_stream[stream_type].actual_frames_to_receive) { stop = false; break; @@ -285,8 +298,6 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) return; } - auto stream_type = rs_get_detached_frame_stream_type(frame, require_no_error()); - if (data->duration_per_stream[stream_type].is_end_time_initialized) { rs_release_frame(dev, frame, require_no_error()); @@ -296,7 +307,7 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) unsigned num_of_frames = 0; num_of_frames = (++data->number_of_frames_per_stream[stream_type]); - if (num_of_frames >= frames_to_receive) + if (num_of_frames >= data->duration_per_stream[stream_type].actual_frames_to_receive) { if (!data->duration_per_stream[stream_type].is_end_time_initialized) { @@ -308,7 +319,7 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) return; } - if ((num_of_frames == first_frame_to_capture) && (!data->duration_per_stream[stream_type].is_start_time_initialized)) // Skip some frames at the beginning to stabilize the stream output + if ((num_of_frames == data->duration_per_stream[stream_type].first_frame_to_capture) && (!data->duration_per_stream[stream_type].is_start_time_initialized)) // Skip some frames at the beginning to stabilize the stream output { data->duration_per_stream[stream_type].start_time = std::chrono::high_resolution_clock::now(); data->duration_per_stream[stream_type].is_start_time_initialized = true; @@ -322,7 +333,7 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) rs_release_frame(dev, frame, require_no_error()); } -inline void test_frame_callback(rs_device * device, std::initializer_list& modes, std::map& duration_per_stream) +inline void test_frame_callback(rs_device * device, std::initializer_list& modes, std::map& duration_per_stream) { done = false; stop_streaming = false; @@ -333,6 +344,9 @@ inline void test_frame_callback(rs_device * device, std::initializer_list(data.duration_per_stream[mode.stream].end_time - data.duration_per_stream[mode.stream].start_time).count(); auto fps = ((float)data.number_of_frames_per_stream[mode.stream] / duration) * 1000.; - //check_fps(fps, mode.framerate); + //check_fps(fps, mode.framerate); / TODO is not suppuorted yet. See above message } } @@ -368,10 +382,10 @@ inline void timestamp_callback(rs_device * , rs_timestamp_data, void *) // Provide support for doing basic streaming tests on a set of specified modes inline void test_streaming(rs_device * device, std::initializer_list modes) { - std::map duration_per_stream; + std::map duration_per_stream; for(auto & mode : modes) { - duration_per_stream.insert(std::pair(mode.stream, time_duration())); + duration_per_stream.insert(std::pair(mode.stream, test_duration())); rs_enable_stream(device, mode.stream, mode.width, mode.height, mode.format, mode.framerate, require_no_error()); REQUIRE( rs_is_stream_enabled(device, mode.stream, require_no_error()) == 1 ); } diff --git a/unit-tests/unit-tests-live-f200.cpp b/unit-tests/unit-tests-live-f200.cpp index b2f34e2948..0eb962ffc0 100644 --- a/unit-tests/unit-tests-live-f200.cpp +++ b/unit-tests/unit-tests-live-f200.cpp @@ -119,6 +119,70 @@ TEST_CASE( "F200 device extrinsics are within expected parameters", "[live] [f20 } } +/////////////////////////// +// Depth streaming tests // +/////////////////////////// + +TEST_CASE("F200 streams depth (Z16)", "[live] [f200] [one-camera]") +{ + safe_context ctx; + REQUIRE(rs_get_device_count(ctx, require_no_error()) == 1); + + rs_device * dev = rs_get_device(ctx, 0, require_no_error()); + REQUIRE(dev != nullptr); + REQUIRE(rs_get_device_name(dev, require_no_error()) == std::string("Intel RealSense F200")); + + SECTION("F200 streams depth 640x480 (VGA), [2,5,15,30,60] fps") + { + for (auto & fps : { 2, 5, 15, 30, 60 }) + { + INFO("Testing " << fps << " fps"); + test_streaming(dev, { { RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, fps } }); + } + } + + SECTION("F200 streams depth 640x240 (HVGA), [2,5,15,30,60,110] fps") + { + for (auto & fps : { 2, 5, 15, 30, 60, 110 }) + { + INFO("Testing " << fps << " fps"); + test_streaming(dev, { { RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, fps } }); + } + } +} + +////////////////////////////// +// Infrared streaming tests // +////////////////////////////// + +TEST_CASE("F200 streams infrared (Y16)", "[live] [f200] [one-camera]") +{ + safe_context ctx; + REQUIRE(rs_get_device_count(ctx, require_no_error()) == 1); + + rs_device * dev = rs_get_device(ctx, 0, require_no_error()); + REQUIRE(dev != nullptr); + REQUIRE(rs_get_device_name(dev, require_no_error()) == std::string("Intel RealSense F200")); + + SECTION("F200 streams infrared 640x480 depth (VGA), [30,60,120,240,300] fps") + { + for (auto & fps : { 30, 60, 120, 240, 300 }) + { + INFO("Testing " << fps << " fps") + test_streaming(dev, { { RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, fps } }); + } + } + + SECTION("F200 streams infrared 640x240 depth (HVGA), [30,60,120,240,300] fps") + { + for (auto & fps : { 30, 60, 120, 240, 300 }) + { + INFO("Testing " << fps << " fps") + test_streaming(dev, { { RS_STREAM_INFRARED, 640, 240, RS_FORMAT_Y16, fps } }); + } + } +} + TEST_CASE( "F200 has no INFRARED2 streaming modes", "[live] [f200]" ) { // Require at least one device to be plugged in @@ -142,7 +206,7 @@ TEST_CASE( "F200 has no INFRARED2 streaming modes", "[live] [f200]" ) TEST_CASE( "a single F200 can stream a variety of reasonable streaming mode combinations", "[live] [f200] [one-camera]" ) { safe_context ctx; - + SECTION( "exactly one device is connected" ) { int device_count = rs_get_device_count(ctx, require_no_error()); From f05915486c3df778a86e3fb3fcc7ee03bbc730ef Mon Sep 17 00:00:00 2001 From: dorodnic Date: Sun, 4 Sep 2016 15:16:43 +0300 Subject: [PATCH 08/12] hard-coding F200 extension controls values (cherry picked from commit 444f547cd1764ec43e4fa0cc090f4096c2db19f1) --- src/f200.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/f200.cpp b/src/f200.cpp index 3557cbe7fd..e9cc8b40b4 100644 --- a/src/f200.cpp +++ b/src/f200.cpp @@ -88,7 +88,15 @@ namespace rsimpl info.presets[RS_STREAM_DEPTH ][RS_PRESET_HIGHEST_FRAMERATE] = {true, 640, 480, RS_FORMAT_Z16, 60}; info.presets[RS_STREAM_COLOR ][RS_PRESET_HIGHEST_FRAMERATE] = {true, 640, 480, RS_FORMAT_RGB8, 60}; - update_supported_options(*device.get(), ivcam::depth_xu, eu_F200_depth_controls, info.options); + // Hardcoded extension controls + // option min max step def + // ------ --- --- ---- --- + info.options.push_back({ RS_OPTION_F200_LASER_POWER, 0, 16, 1, 16 }); + info.options.push_back({ RS_OPTION_F200_ACCURACY, 1, 3, 1, 2 }); + info.options.push_back({ RS_OPTION_F200_MOTION_RANGE, 0, 100, 1, 0 }); + info.options.push_back({ RS_OPTION_F200_FILTER_OPTION, 0, 7, 1, 5 }); + info.options.push_back({ RS_OPTION_F200_CONFIDENCE_THRESHOLD, 0, 15, 1, 6 }); + info.options.push_back({ RS_OPTION_F200_DYNAMIC_FPS, 0, 1000, 1, 60 }); rsimpl::pose depth_to_color = {transpose((const float3x3 &)c.Rt), (const float3 &)c.Tt * 0.001f}; // convert mm to m info.stream_poses[RS_STREAM_DEPTH] = info.stream_poses[RS_STREAM_INFRARED] = inverse(depth_to_color); From 397421f3997fbb840f87281f38e0dd8dc4ff00b9 Mon Sep 17 00:00:00 2001 From: Evgeni Raikhel Date: Mon, 5 Sep 2016 12:17:47 +0300 Subject: [PATCH 09/12] Remove F200Depth/110 FPS configuration due to a FW bug in timestamp field. Change encoding format for device.cpp to UTF-8. handle cimpiler warnings/redundnant code --- src/device.cpp | 6 +++--- src/f200.cpp | 2 +- src/stream.h | 2 +- unit-tests/unit-tests-common.h | 3 --- unit-tests/unit-tests-live-f200.cpp | 6 +++--- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/device.cpp b/src/device.cpp index fade755e84..53af48c6c1 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -333,7 +333,7 @@ void rs_device_base::start_video_streaming() // dispatching the uvc configuration for a requested stream to the hardware for(auto mode_selection : selected_modes) { - assert(mode_selection.mode.subdevice <= timestamp_readers.size()); + assert((size_t)mode_selection.mode.subdevice <= timestamp_readers.size()); auto timestamp_reader = timestamp_readers[mode_selection.mode.subdevice]; // Create a stream buffer for each stream served by this subdevice mode @@ -522,8 +522,8 @@ const char * rs_device_base::get_option_description(rs_option option) const case RS_OPTION_R200_LR_EXPOSURE : return "This control allows manual adjustment of the exposure time value for the L/R imagers"; case RS_OPTION_R200_EMITTER_ENABLED : return "Enables / disables R200 emitter"; case RS_OPTION_R200_DEPTH_UNITS : return "Micrometers per increment in integer depth values, 1000 is default (mm scale). Set before streaming"; - case RS_OPTION_R200_DEPTH_CLAMP_MIN : return "Minimum depth in current depth units that will be output. Any values less than ‘Min Depth’ will be mapped to 0 during the conversion between disparity and depth. Set before streaming"; - case RS_OPTION_R200_DEPTH_CLAMP_MAX : return "Maximum depth in current depth units that will be output. Any values greater than ‘Max Depth’ will be mapped to 0 during the conversion between disparity and depth. Set before streaming"; + case RS_OPTION_R200_DEPTH_CLAMP_MIN : return "Minimum depth in current depth units that will be output. Any values less than 'Min Depth' will be mapped to 0 during the conversion between disparity and depth. Set before streaming"; + case RS_OPTION_R200_DEPTH_CLAMP_MAX : return "Maximum depth in current depth units that will be output. Any values greater than 'Max Depth' will be mapped to 0 during the conversion between disparity and depth. Set before streaming"; case RS_OPTION_R200_DISPARITY_MULTIPLIER : return "The disparity scale factor used when in disparity output mode. Can only be set before streaming"; case RS_OPTION_R200_DISPARITY_SHIFT : return "{0 - 512}. Can only be set before streaming starts"; case RS_OPTION_R200_AUTO_EXPOSURE_MEAN_INTENSITY_SET_POINT : return "(Requires LR-Auto-Exposure ON) Mean intensity set point"; diff --git a/src/f200.cpp b/src/f200.cpp index e9cc8b40b4..0bae8b97a3 100644 --- a/src/f200.cpp +++ b/src/f200.cpp @@ -33,7 +33,7 @@ namespace rsimpl }; static const cam_mode f200_depth_modes[] = { {{640, 480}, {2,5,15,30,60}}, - {{640, 240}, {2,5,15,30,60,110}} + {{640, 240}, {2,5,15,30,60}} // 110 FPS is excluded due to a bug in timestamp field }; static const cam_mode f200_ir_only_modes[] = { {{640, 480}, {30,60,120,240,300}}, diff --git a/src/stream.h b/src/stream.h index 51d42f20c4..e6faa253d7 100644 --- a/src/stream.h +++ b/src/stream.h @@ -13,7 +13,7 @@ namespace rsimpl { struct stream_interface : rs_stream_interface { - stream_interface(calibration_validator in_validator, rs_stream in_stream) : validator(in_validator), stream(in_stream){}; + stream_interface(calibration_validator in_validator, rs_stream in_stream) : stream(in_stream), validator(in_validator){}; virtual rs_extrinsics get_extrinsics_to(const rs_stream_interface & other) const override; virtual rsimpl::pose get_pose() const = 0; diff --git a/unit-tests/unit-tests-common.h b/unit-tests/unit-tests-common.h index 911d263ddb..54ced15941 100644 --- a/unit-tests/unit-tests-common.h +++ b/unit-tests/unit-tests-common.h @@ -222,7 +222,6 @@ inline void test_wait_for_frames(rs_device * device, std::initializer_list= 0); - REQUIRE( rs_get_frame_number(device, mode.stream, require_no_error()) >= 0); auto frame_number = rs_get_frame_number(device, mode.stream, require_no_error()); if (!duration_per_stream[mode.stream].is_end_time_initialized && last_frame_number[mode.stream] != frame_number) @@ -325,10 +324,8 @@ inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) data->duration_per_stream[stream_type].is_start_time_initialized = true; } - REQUIRE( rs_get_detached_frame_data(frame, require_no_error()) != nullptr ); REQUIRE( rs_get_detached_frame_timestamp(frame, require_no_error()) >= 0 ); - REQUIRE( rs_get_detached_frame_number(frame, require_no_error()) >= 0 ); rs_release_frame(dev, frame, require_no_error()); } diff --git a/unit-tests/unit-tests-live-f200.cpp b/unit-tests/unit-tests-live-f200.cpp index 0eb962ffc0..4bb9b43b52 100644 --- a/unit-tests/unit-tests-live-f200.cpp +++ b/unit-tests/unit-tests-live-f200.cpp @@ -141,9 +141,9 @@ TEST_CASE("F200 streams depth (Z16)", "[live] [f200] [one-camera]") } } - SECTION("F200 streams depth 640x240 (HVGA), [2,5,15,30,60,110] fps") + SECTION("F200 streams depth 640x240 (HVGA), [2,5,15,30,60] fps") { - for (auto & fps : { 2, 5, 15, 30, 60, 110 }) + for (auto & fps : { 2, 5, 15, 30, 60}) { INFO("Testing " << fps << " fps"); test_streaming(dev, { { RS_STREAM_DEPTH, 640, 240, RS_FORMAT_Z16, fps } }); @@ -250,4 +250,4 @@ TEST_CASE( "a single F200 can stream a variety of reasonable streaming mode comb } } -#endif /* !defined(MAKEFILE) || ( defined(F200_TEST) && defined(LIVE_TEST) ) */ \ No newline at end of file +#endif /* !defined(MAKEFILE) || ( defined(F200_TEST) && defined(LIVE_TEST) ) */ From a38efbb6cfc6f98a374383d82e91400b1ec93307 Mon Sep 17 00:00:00 2001 From: Evgeni Raikhel Date: Mon, 5 Sep 2016 13:08:10 +0300 Subject: [PATCH 10/12] Add description of configuration under test in case of failure --- unit-tests/unit-tests-live-sr300.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unit-tests/unit-tests-live-sr300.cpp b/unit-tests/unit-tests-live-sr300.cpp index f641c897df..053a21b7ea 100644 --- a/unit-tests/unit-tests-live-sr300.cpp +++ b/unit-tests/unit-tests-live-sr300.cpp @@ -384,20 +384,24 @@ TEST_CASE( "a single SR300 can stream a variety of reasonable streaming mode com SECTION( "streaming is possible in some reasonable configurations" ) { + INFO("Streaming Z16, 60 fps"); test_streaming(dev, { {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60} }); + INFO("Streaming Depth + Color 60 fps"); test_streaming(dev, { {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60}, {RS_STREAM_COLOR, 640, 480, RS_FORMAT_RGB8, 60} }); + INFO("Streaming Depth + Infrared 60 fps"); test_streaming(dev, { {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60}, {RS_STREAM_INFRARED, 640, 480, RS_FORMAT_Y16, 60} }); + INFO("Streaming Depth + Infrared + Color 60 fps"); test_streaming(dev, { {RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60}, {RS_STREAM_COLOR, 640, 480, RS_FORMAT_RGB8, 60}, @@ -471,4 +475,4 @@ inline void test_sr300_command(rs_device *dev, std::vector options_li } } -#endif /* !defined(MAKEFILE) || ( defined(LIVE_TEST) && defined(SR300_TEST) ) */ \ No newline at end of file +#endif /* !defined(MAKEFILE) || ( defined(LIVE_TEST) && defined(SR300_TEST) ) */ From 265d8366e86ccd656caaa730df801b506f3d658a Mon Sep 17 00:00:00 2001 From: "evgeni.raikhel" Date: Mon, 5 Sep 2016 16:27:27 +0300 Subject: [PATCH 11/12] Update MSVC project references --- librealsense.vc12/cpp-alignimages/cpp-alignimages.vcxproj | 3 +++ librealsense.vc12/cpp-callback/cpp-callback.vcxproj | 3 --- librealsense.vc12/cpp-capture/cpp-capture.vcxproj | 3 +++ librealsense.vc12/cpp-config-ui/cpp-config-ui.vcxproj | 3 +++ .../cpp-enumerate-devices/cpp-enumerate-devices.vcxproj | 5 +++++ librealsense.vc12/cpp-headless/cpp-headless.vcxproj | 5 +++++ librealsense.vc12/cpp-multicam/cpp-multicam.vcxproj | 3 +++ librealsense.vc12/cpp-pointcloud/cpp-pointcloud.vcxproj | 3 +++ librealsense.vc12/cpp-restart/cpp-restart.vcxproj | 3 +++ .../unit-tests-live-f200/unit-tests-live-f200.vcxproj | 5 +++++ .../unit-tests-live-lr200/unit-tests-live-lr200.vcxproj | 5 +++++ .../unit-tests-live-r200/unit-tests-live-ds4.vcxproj | 5 +++++ .../unit-tests-live-sr300/unit-tests-live-sr300.vcxproj | 5 +++++ .../unit-tests-live-zr300/unit-tests-live-zr300.vcxproj | 5 +++++ .../unit-tests-offline/unit-tests-offline.vcxproj | 5 +++++ .../unit-tests-live-f200/unit-tests-live-f200.vcxproj | 8 ++++++++ 16 files changed, 66 insertions(+), 3 deletions(-) diff --git a/librealsense.vc12/cpp-alignimages/cpp-alignimages.vcxproj b/librealsense.vc12/cpp-alignimages/cpp-alignimages.vcxproj index c50ee66e90..e66f326dd0 100644 --- a/librealsense.vc12/cpp-alignimages/cpp-alignimages.vcxproj +++ b/librealsense.vc12/cpp-alignimages/cpp-alignimages.vcxproj @@ -160,6 +160,9 @@ {979d0add-6ab7-403a-bb17-5434615e4446} + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + diff --git a/librealsense.vc12/cpp-callback/cpp-callback.vcxproj b/librealsense.vc12/cpp-callback/cpp-callback.vcxproj index 7c136ede51..7c5cc81c29 100644 --- a/librealsense.vc12/cpp-callback/cpp-callback.vcxproj +++ b/librealsense.vc12/cpp-callback/cpp-callback.vcxproj @@ -151,9 +151,6 @@ - - {979d0add-6ab7-403a-bb17-5434615e4446} - {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} diff --git a/librealsense.vc12/cpp-capture/cpp-capture.vcxproj b/librealsense.vc12/cpp-capture/cpp-capture.vcxproj index b370b32410..504212c675 100644 --- a/librealsense.vc12/cpp-capture/cpp-capture.vcxproj +++ b/librealsense.vc12/cpp-capture/cpp-capture.vcxproj @@ -160,6 +160,9 @@ {979d0add-6ab7-403a-bb17-5434615e4446} + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + diff --git a/librealsense.vc12/cpp-config-ui/cpp-config-ui.vcxproj b/librealsense.vc12/cpp-config-ui/cpp-config-ui.vcxproj index 15060e229c..cb1dc1f3dd 100644 --- a/librealsense.vc12/cpp-config-ui/cpp-config-ui.vcxproj +++ b/librealsense.vc12/cpp-config-ui/cpp-config-ui.vcxproj @@ -157,6 +157,9 @@ {979d0add-6ab7-403a-bb17-5434615e4446} + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + diff --git a/librealsense.vc12/cpp-enumerate-devices/cpp-enumerate-devices.vcxproj b/librealsense.vc12/cpp-enumerate-devices/cpp-enumerate-devices.vcxproj index 7af58eb435..c6a3ef3216 100644 --- a/librealsense.vc12/cpp-enumerate-devices/cpp-enumerate-devices.vcxproj +++ b/librealsense.vc12/cpp-enumerate-devices/cpp-enumerate-devices.vcxproj @@ -150,6 +150,11 @@ + + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + + diff --git a/librealsense.vc12/cpp-headless/cpp-headless.vcxproj b/librealsense.vc12/cpp-headless/cpp-headless.vcxproj index a4f05060bc..e31632eebd 100644 --- a/librealsense.vc12/cpp-headless/cpp-headless.vcxproj +++ b/librealsense.vc12/cpp-headless/cpp-headless.vcxproj @@ -21,6 +21,11 @@ + + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + + {7F7D0E8C-1614-411C-AD0A-C3D583EC5811} Win32Proj diff --git a/librealsense.vc12/cpp-multicam/cpp-multicam.vcxproj b/librealsense.vc12/cpp-multicam/cpp-multicam.vcxproj index 25b8e38c89..a701faf9fc 100644 --- a/librealsense.vc12/cpp-multicam/cpp-multicam.vcxproj +++ b/librealsense.vc12/cpp-multicam/cpp-multicam.vcxproj @@ -160,6 +160,9 @@ {979d0add-6ab7-403a-bb17-5434615e4446} + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + diff --git a/librealsense.vc12/cpp-pointcloud/cpp-pointcloud.vcxproj b/librealsense.vc12/cpp-pointcloud/cpp-pointcloud.vcxproj index 5d14596812..9bd902b0a4 100644 --- a/librealsense.vc12/cpp-pointcloud/cpp-pointcloud.vcxproj +++ b/librealsense.vc12/cpp-pointcloud/cpp-pointcloud.vcxproj @@ -160,6 +160,9 @@ {979d0add-6ab7-403a-bb17-5434615e4446} + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + diff --git a/librealsense.vc12/cpp-restart/cpp-restart.vcxproj b/librealsense.vc12/cpp-restart/cpp-restart.vcxproj index 700e47050e..1188e228a4 100644 --- a/librealsense.vc12/cpp-restart/cpp-restart.vcxproj +++ b/librealsense.vc12/cpp-restart/cpp-restart.vcxproj @@ -160,6 +160,9 @@ {979d0add-6ab7-403a-bb17-5434615e4446} + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + diff --git a/librealsense.vc12/unit-tests-live-f200/unit-tests-live-f200.vcxproj b/librealsense.vc12/unit-tests-live-f200/unit-tests-live-f200.vcxproj index d675dc02a7..77727f6fdf 100644 --- a/librealsense.vc12/unit-tests-live-f200/unit-tests-live-f200.vcxproj +++ b/librealsense.vc12/unit-tests-live-f200/unit-tests-live-f200.vcxproj @@ -25,6 +25,11 @@ + + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + + {D37BF473-AEE1-4097-9E0B-C1A8A5BF97EC} Win32Proj diff --git a/librealsense.vc12/unit-tests-live-lr200/unit-tests-live-lr200.vcxproj b/librealsense.vc12/unit-tests-live-lr200/unit-tests-live-lr200.vcxproj index 551f663f6a..35b61ef8e5 100644 --- a/librealsense.vc12/unit-tests-live-lr200/unit-tests-live-lr200.vcxproj +++ b/librealsense.vc12/unit-tests-live-lr200/unit-tests-live-lr200.vcxproj @@ -27,6 +27,11 @@ + + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + + {9D0CA8E1-96E2-4A56-9000-F52035256190} Win32Proj diff --git a/librealsense.vc12/unit-tests-live-r200/unit-tests-live-ds4.vcxproj b/librealsense.vc12/unit-tests-live-r200/unit-tests-live-ds4.vcxproj index 8a5ea0c8ac..be84efd6aa 100644 --- a/librealsense.vc12/unit-tests-live-r200/unit-tests-live-ds4.vcxproj +++ b/librealsense.vc12/unit-tests-live-r200/unit-tests-live-ds4.vcxproj @@ -27,6 +27,11 @@ + + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + + {7B497980-3BB8-4699-A459-0F3091D24E03} Win32Proj diff --git a/librealsense.vc12/unit-tests-live-sr300/unit-tests-live-sr300.vcxproj b/librealsense.vc12/unit-tests-live-sr300/unit-tests-live-sr300.vcxproj index 4c87426bf2..fda560983d 100644 --- a/librealsense.vc12/unit-tests-live-sr300/unit-tests-live-sr300.vcxproj +++ b/librealsense.vc12/unit-tests-live-sr300/unit-tests-live-sr300.vcxproj @@ -154,6 +154,11 @@ + + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + + diff --git a/librealsense.vc12/unit-tests-live-zr300/unit-tests-live-zr300.vcxproj b/librealsense.vc12/unit-tests-live-zr300/unit-tests-live-zr300.vcxproj index 97e83e0c3c..d45c4f10bd 100644 --- a/librealsense.vc12/unit-tests-live-zr300/unit-tests-live-zr300.vcxproj +++ b/librealsense.vc12/unit-tests-live-zr300/unit-tests-live-zr300.vcxproj @@ -28,6 +28,11 @@ + + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + + {1B6AC368-20CD-4016-9452-8621E06349CE} Win32Proj diff --git a/librealsense.vc12/unit-tests-offline/unit-tests-offline.vcxproj b/librealsense.vc12/unit-tests-offline/unit-tests-offline.vcxproj index 2bdc089c5c..b433693773 100644 --- a/librealsense.vc12/unit-tests-offline/unit-tests-offline.vcxproj +++ b/librealsense.vc12/unit-tests-offline/unit-tests-offline.vcxproj @@ -24,6 +24,11 @@ + + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + + {B57FBF49-D142-4CCA-AFCB-E5F1687EE217} Win32Proj diff --git a/librealsense.vc14/unit-tests-live-f200/unit-tests-live-f200.vcxproj b/librealsense.vc14/unit-tests-live-f200/unit-tests-live-f200.vcxproj index 6f003f0830..e7300af02f 100644 --- a/librealsense.vc14/unit-tests-live-f200/unit-tests-live-f200.vcxproj +++ b/librealsense.vc14/unit-tests-live-f200/unit-tests-live-f200.vcxproj @@ -25,6 +25,14 @@ + + + {622186c4-6d7d-4288-b8fd-8f08419181c2} + + + {1ae4ceb5-9a0b-4b9f-9505-824fd56bb41f} + + {D37BF473-AEE1-4097-9E0B-C1A8A5BF97EC} Win32Proj From c77c39b6d089688fc4d42dbe724a1de44755cf15 Mon Sep 17 00:00:00 2001 From: "evgeni.raikhel" Date: Mon, 5 Sep 2016 16:30:42 +0300 Subject: [PATCH 12/12] Prevent callbacks overlapping in unit-tests. Need to be refactored later along with fps verification --- unit-tests/unit-tests-common.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/unit-tests/unit-tests-common.h b/unit-tests/unit-tests-common.h index 54ced15941..40645d2613 100644 --- a/unit-tests/unit-tests-common.h +++ b/unit-tests/unit-tests-common.h @@ -254,6 +254,7 @@ inline void test_wait_for_frames(rs_device * device, std::initializer_list stop_streaming; static int done; @@ -262,8 +263,11 @@ struct user_data{ std::map number_of_frames_per_stream; }; + inline void frame_callback(rs_device * dev, rs_frame_ref * frame, void * user) { + std::lock_guard lock(cb_mtx); + if (stop_streaming || (rs_get_detached_frame_timestamp(frame, require_no_error()) == 0)) { rs_release_frame(dev, frame, require_no_error());