From 34d158b2994858ad044ec1cf42d667ee7fbce049 Mon Sep 17 00:00:00 2001
From: Moses Turner <moses@collabora.com>
Date: Sun, 18 Sep 2022 08:06:34 -0500
Subject: [PATCH] d/dai: Use setXLinkChunkSize(0) to reduce latency

---
 src/xrt/drivers/depthai/depthai_driver.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/xrt/drivers/depthai/depthai_driver.cpp b/src/xrt/drivers/depthai/depthai_driver.cpp
index ef6e41686..3f65ef3e5 100644
--- a/src/xrt/drivers/depthai/depthai_driver.cpp
+++ b/src/xrt/drivers/depthai/depthai_driver.cpp
@@ -627,6 +627,7 @@ depthai_setup_monocular_pipeline(struct depthai_fs *depthai, enum depthai_camera
 		grayCam->out.link(xlinkOut->input);
 	}
 
+	p.setXLinkChunkSize(0);
 
 	// Start the pipeline
 	depthai->device->startPipeline(p);
@@ -702,6 +703,8 @@ depthai_setup_stereo_grayscale_pipeline(struct depthai_fs *depthai)
 		imu->out.link(xlinkOut_imu->input);
 	}
 
+	p.setXLinkChunkSize(0);
+
 	// Start the pipeline
 	depthai->device->startPipeline(p);
 	if (depthai->want_cameras) {
@@ -768,6 +771,8 @@ depthai_setup_stereo_rgb_pipeline(struct depthai_fs *depthai)
 		grayCam->preview.link(xlinkOut->input);
 	}
 
+	p.setXLinkChunkSize(0);
+
 	// Start the pipeline
 	depthai->device->startPipeline(p);
 	depthai->queue = depthai->device->getOutputQueue(name, 4, false).get(); // out of shared pointer