diag(windows-nui): log every GetNextFrame/SkeletonGetNextFrame entry + wait result + stream event handles
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:05:56 -05:00
1 parent 4a2c0b653b
commit 7314effff6
1 file changed
+31 -17
+31 -17
View File
@@ -222,6 +222,13 @@ HRESULT VirtualKinectSensor::SkeletonGetNextFrame(
if (pSkeletonFrame == nullptr) {
return E_POINTER;
}
static unsigned skel_calls = 0;
const bool slog = skel_calls < 20u;
++skel_calls;
if (slog) {
ShimLog("SkeletonGetNextFrame ENTER enabled=%d waitMs=%lu flags=0x%X",
skeleton_enabled_ ? 1 : 0, dwMillisecondsToWait, skeleton_flags_);
}
if (!skeleton_enabled_) {
return E_NUI_STREAM_NOT_ENABLED;
}
@@ -229,6 +236,9 @@ HRESULT VirtualKinectSensor::SkeletonGetNextFrame(
const DWORD wait = WaitForSingleObject(skeleton_ready_event_,
dwMillisecondsToWait);
if (wait != WAIT_OBJECT_0) {
if (slog) {
ShimLog(" skeleton wait=%lu (not signalled)", wait);
}
if (skeleton_flags_ &
NUI_SKELETON_TRACKING_FLAG_TITLE_SETS_TRACKED_SKELETONS) {
return S_FALSE;
@@ -237,12 +247,6 @@ HRESULT VirtualKinectSensor::SkeletonGetNextFrame(
}
EnterCriticalSection(&lock_);
static unsigned skel_calls = 0;
if (skel_calls < 6 || (skel_calls % 150u) == 0u) {
ShimLog("SkeletonGetNextFrame call#%u has_skeleton=%d", skel_calls,
has_skeleton_ ? 1 : 0);
}
++skel_calls;
if (!has_skeleton_) {
LeaveCriticalSection(&lock_);
return E_NUI_FRAME_NO_DATA;
@@ -333,9 +337,9 @@ HRESULT VirtualKinectSensor::ImageStreamOpen(NUI_IMAGE_TYPE eImageType,
*phStreamHandle = reinterpret_cast<HANDLE>(slot);
LeaveCriticalSection(&lock_);
ShimLog("ImageStreamOpen type=%d res=%d -> %ux%u bpp=%u ring=%zu",
ShimLog("ImageStreamOpen type=%d res=%d -> %ux%u bpp=%u ring=%zu event=%p",
static_cast<int>(eImageType), static_cast<int>(eResolution), width,
height, bpp, slot->ring_size);
height, bpp, slot->ring_size, hNextFrameEvent);
return S_OK;
}
@@ -357,12 +361,24 @@ HRESULT VirtualKinectSensor::ImageStreamGetNextFrame(
}
ImageStream* stream = nullptr;
HANDLE app_event = nullptr;
int stype = -1;
EnterCriticalSection(&lock_);
stream = StreamFromHandle(hStream);
if (stream != nullptr) {
app_event = stream->app_event;
stype = static_cast<int>(stream->type);
}
LeaveCriticalSection(&lock_);
static unsigned gnf_calls[8] = {0};
const int log_idx = (stype >= 0 && stype < 7) ? stype : 7;
const bool do_log = gnf_calls[log_idx] < 20u;
++gnf_calls[log_idx];
if (do_log) {
ShimLog("ImageStreamGetNextFrame ENTER type=%d handle_ok=%d app_event=%p waitMs=%lu",
stype, stream != nullptr ? 1 : 0, app_event, dwMillisecondsToWait);
}
if (stream == nullptr) {
return E_INVALIDARG;
}
@@ -370,12 +386,15 @@ HRESULT VirtualKinectSensor::ImageStreamGetNextFrame(
if (app_event != nullptr) {
const DWORD wait = WaitForSingleObject(app_event, dwMillisecondsToWait);
if (wait != WAIT_OBJECT_0) {
if (do_log) {
ShimLog(" type=%d event wait=%lu (not signalled) => NO_DATA", stype,
wait);
}
return E_NUI_FRAME_NO_DATA;
}
}
EnterCriticalSection(&lock_);
const int stype = static_cast<int>(stream->type);
const bool has = stream->has_frame;
const uint32_t frame_no =
has ? stream->frames[stream->latest_index].dwFrameNumber : 0u;
@@ -387,14 +406,9 @@ HRESULT VirtualKinectSensor::ImageStreamGetNextFrame(
}
LeaveCriticalSection(&lock_);
if (stype == 1) {
static unsigned color_calls = 0;
if (color_calls < 30u) {
ShimLog("color GetNextFrame call#%u has=%d new=%d frame=%u -> %s",
color_calls, has ? 1 : 0, is_new ? 1 : 0, frame_no,
is_new ? "S_OK" : "NO_DATA");
}
++color_calls;
if (do_log) {
ShimLog(" type=%d has=%d new=%d frame=%u => %s", stype, has ? 1 : 0,
is_new ? 1 : 0, frame_no, is_new ? "S_OK" : "NO_DATA");
}
if (!is_new) {
return E_NUI_FRAME_NO_DATA;