diff --git a/tests/include/fsync_ptp_test_utils.hpp b/tests/include/fsync_ptp_test_utils.hpp index 2d59a3bf52..c14f043399 100644 --- a/tests/include/fsync_ptp_test_utils.hpp +++ b/tests/include/fsync_ptp_test_utils.hpp @@ -56,7 +56,8 @@ void setUpCameraSocket(std::shared_ptr& pipeline, std::optional role, std::optional>& masterNode, std::map>>& slaveQueues, - std::vector& camSockets); + std::vector& camSockets, + std::string &ptpMasterDeviceName); void setUpIrLeds(std::shared_ptr device); @@ -68,6 +69,7 @@ void setupDevice(dai::DeviceInfo& deviceInfo, std::map>>& slaveQueues, std::vector& camSockets, float targetFps, - SyncType syncType); + SyncType syncType, + std::string &ptpMasterDeviceName); int testFsync(float targetFps, struct FsyncTestParameters parameters); \ No newline at end of file diff --git a/tests/src/onhost_tests/multi_device_ptp_test.cpp b/tests/src/onhost_tests/multi_device_ptp_test.cpp index 9a70f58db8..693af5a3eb 100644 --- a/tests/src/onhost_tests/multi_device_ptp_test.cpp +++ b/tests/src/onhost_tests/multi_device_ptp_test.cpp @@ -6,7 +6,7 @@ TEST_CASE("Test Multi-device PTP frame sync with different FPS values", "[ptp]") { // auto fps = GENERATE(10.0f, 13.0f, 18.5f, 30.0f, 60.0f, 120.0f, 240.0f, 300.0f, 600.0f); // 60 FPS does not work as of 1.30.1 - auto fps = GENERATE(10.0f, 13.0f, 18.5f, 30.0f, 45.0f); + auto fps = GENERATE(10.0f, 15.0f, 18.5f, 30.0f, 45.0f); CAPTURE(fps); struct FsyncTestParameters parameters {}; parameters.syncThresholdSec = 1 / (2 * fps); // lower this limit when we have better accuracy for timestamps diff --git a/tests/src/onhost_tests/utility/fsync_ptp_test_utils.cpp b/tests/src/onhost_tests/utility/fsync_ptp_test_utils.cpp index 2ac951a958..f0e03b056e 100644 --- a/tests/src/onhost_tests/utility/fsync_ptp_test_utils.cpp +++ b/tests/src/onhost_tests/utility/fsync_ptp_test_utils.cpp @@ -183,7 +183,8 @@ void setUpCameraSocket(std::shared_ptr& pipeline, std::optional role, std::optional>& masterNode, std::map>>& slaveQueues, - std::vector& camSockets) { + std::vector& camSockets, + std::string &ptpMasterDeviceName) { auto outNode = createPipeline(pipeline, socket, targetFps, syncType, role); if(syncType == SyncType::EXTERNAL) { @@ -207,6 +208,9 @@ void setUpCameraSocket(std::shared_ptr& pipeline, // Actual PTP master might be different, but it doesn't matter for this test. if(!masterNode.has_value()) { masterNode.emplace(); + ptpMasterDeviceName = name; + } + if (ptpMasterDeviceName == name) { masterNode.value().emplace(dai::toString(socket), outNode); } else { if(slaveQueues.find(name) == slaveQueues.end()) { @@ -255,7 +259,8 @@ void setupDevice(dai::DeviceInfo& deviceInfo, std::map>>& slaveQueues, std::vector& camSockets, float targetFps, - SyncType syncType) { + SyncType syncType, + std::string &ptpMasterDeviceName) { auto pipeline = std::make_shared(std::make_shared(deviceInfo)); auto device = pipeline->getDefaultDevice(); @@ -274,7 +279,7 @@ void setupDevice(dai::DeviceInfo& deviceInfo, std::cout << " Num of cameras: " << device->getConnectedCameras().size() << std::endl; for(auto socket : device->getConnectedCameras()) { - setUpCameraSocket(pipeline, socket, name, targetFps, syncType, role, masterNode, slaveQueues, camSockets); + setUpCameraSocket(pipeline, socket, name, targetFps, syncType, role, masterNode, slaveQueues, camSockets, ptpMasterDeviceName); } setUpIrLeds(device); @@ -330,8 +335,10 @@ int testFsync(float targetFps, struct FsyncTestParameters parameters) { std::vector outputNames; std::vector camSockets; + std::string ptpMasterDeviceName = ""; + for(auto deviceInfo : deviceInfos) { - setupDevice(deviceInfo, masterPipeline, masterNode, masterName, slavePipelines, slaveQueues, camSockets, targetFps, parameters.syncType); + setupDevice(deviceInfo, masterPipeline, masterNode, masterName, slavePipelines, slaveQueues, camSockets, targetFps, parameters.syncType, ptpMasterDeviceName); } if(masterPipeline == nullptr || !masterNode.has_value() || !masterName.has_value()) {