summaryrefslogtreecommitdiffhomepage
path: root/tracker-kinect-face/camera_kinect_ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-kinect-face/camera_kinect_ir.cpp')
-rw-r--r--tracker-kinect-face/camera_kinect_ir.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/tracker-kinect-face/camera_kinect_ir.cpp b/tracker-kinect-face/camera_kinect_ir.cpp
index 81357a6d..024fd703 100644
--- a/tracker-kinect-face/camera_kinect_ir.cpp
+++ b/tracker-kinect-face/camera_kinect_ir.cpp
@@ -221,6 +221,7 @@ namespace Kinect {
bool InfraredCamera::get_frame_(cv::Mat& aFrame)
{
+ unsigned attempts = 0;
if (!iInfraredFrameReader)
{
@@ -231,11 +232,26 @@ namespace Kinect {
// Release previous frame if any
SafeRelease(iInfraredFrame);
-
+start:
HRESULT hr = iInfraredFrameReader->AcquireLatestFrame(&iInfraredFrame);
if (SUCCEEDED(hr))
{
+
+ {
+ TIMESPAN t = 0;
+
+ (void)iInfraredFrame->get_RelativeTime(&t);
+
+ if (t == timestamp && ++attempts < 10)
+ {
+ portable::sleep(2);
+ goto start;
+ }
+
+ timestamp = t;
+ }
+
if (iFirstFrame)
{
IFrameDescription* frameDescription = NULL;