fix(windows-nui): precise 30fps producer cadence (timeBeginPeriod(1)+deadline pacing) so sensor watchdog stays responsive
ci / Linux C++ core (cmake + ctest) (push) Canceled after 0s
ci / Python root tests (pytest, no tracker deps) (push) Canceled after 0s
ci / Python tracker (pytest, tracker/.venv) (push) Canceled after 0s

This commit is contained in:
kinect-bot committed 2026-11-25 16:47:13 -05:00
1 parent 4209340387
commit 372dc29185
3 files changed
+19 -3

No files matched your search

+1 -1
View File
@@ -44,4 +44,4 @@ else()
)
endif()
target_link_libraries(kinect10 PRIVATE ole32 oleaut32 uuid)
target_link_libraries(kinect10 PRIVATE ole32 oleaut32 uuid winmm)
+1 -1
View File
@@ -27,7 +27,7 @@ SRCS=(
INCLUDES=(-I"${HERE}/include" -I"${HERE}/src" -I"${CORE}")
COMMON_FLAGS=(-std=c++17 -O2 -Wall -Wextra -shared -static -static-libgcc -static-libstdc++)
LINK_FLAGS=(-Wl,--enable-stdcall-fixup -Wl,--kill-at -lole32 -loleaut32 -luuid)
LINK_FLAGS=(-Wl,--enable-stdcall-fixup -Wl,--kill-at -lole32 -loleaut32 -luuid -lwinmm)
mkdir -p "${OUT}"
+17 -1
View File
@@ -1,5 +1,7 @@
#include "sensor.h"
#include <timeapi.h>
#include "shim_log.h"
#include <algorithm>
@@ -560,6 +562,7 @@ void VirtualKinectSensor::ProducerLoop() {
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&start);
uint32_t frame_number = 0;
timeBeginPeriod(1);
while (WaitForSingleObject(stop_event_, 0) != WAIT_OBJECT_0) {
LARGE_INTEGER now;
@@ -616,8 +619,21 @@ void VirtualKinectSensor::ProducerLoop() {
SetEvent(frame_end);
}
WaitForSingleObject(stop_event_, kFramePeriodMs);
const int64_t target_qpc =
start.QuadPart +
static_cast<int64_t>(frame_number) * frequency.QuadPart / 30;
QueryPerformanceCounter(&now);
const int64_t remaining_qpc = target_qpc - now.QuadPart;
DWORD wait_ms = 0;
if (remaining_qpc > 0) {
wait_ms = static_cast<DWORD>(remaining_qpc * 1000 / frequency.QuadPart);
if (wait_ms > 100u) {
wait_ms = 100u;
}
}
WaitForSingleObject(stop_event_, wait_ms);
}
timeEndPeriod(1);
ShimLog("producer loop EXIT at tick=%u (stop_event signalled)", frame_number);
}