feat(tracker-native): kinect_tracker.log diagnostics for playtest
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

Adds a ShimLog-style trace log next to the exe (startup, camera enumeration,
negotiated capture format + MF_MT_DEFAULT_STRIDE, per-N-frame presence/tracked,
shm CreateFileMapping result, errors) so the first real-hardware run is
diagnosable instead of blind - mirrors how kinect_shim.log drove the shim fixes.
Logs the camera stride so a top-down/bottom-up RGB32 image-flip is immediately
visible.
This commit is contained in:
kinect-bot committed 2026-11-25 19:04:20 -05:00
1 parent 31178f1675
commit b2513c5722
5 files changed
+96 -2

No files matched your search

+17
View File
@@ -9,6 +9,8 @@
#include <cstring>
#include "trace_log.h"
namespace kinect_tracker {
namespace {
@@ -131,20 +133,29 @@ bool Camera::open(const std::wstring& symbolic_link, int width, int height) {
hr = reader->SetCurrentMediaType(MF_SOURCE_READER_FIRST_VIDEO_STREAM, nullptr, mt);
SafeRelease(&mt);
if (FAILED(hr)) {
TraceLog("camera open FAILED: SetCurrentMediaType RGB32 %dx%d hr=0x%08lX",
width, height, static_cast<unsigned long>(hr));
SafeRelease(&reader);
return false;
}
IMFMediaType* cur = nullptr;
LONG stride = 0;
if (SUCCEEDED(reader->GetCurrentMediaType(MF_SOURCE_READER_FIRST_VIDEO_STREAM, &cur))) {
UINT32 w = 0, h = 0;
if (SUCCEEDED(MFGetAttributeSize(cur, MF_MT_FRAME_SIZE, &w, &h))) {
width = static_cast<int>(w);
height = static_cast<int>(h);
}
UINT32 s = 0;
if (SUCCEEDED(cur->GetUINT32(MF_MT_DEFAULT_STRIDE, &s))) {
stride = static_cast<LONG>(s);
}
SafeRelease(&cur);
}
TraceLog("camera open OK: negotiated %dx%d default_stride=%ld (expect top-down +%d)",
width, height, stride, width * 4);
reader_ = reader;
width_ = width;
height_ = height;
@@ -169,6 +180,12 @@ bool Camera::read_frame(std::vector<uint8_t>& bgra, int& width, int& height) {
DWORD max_len = 0, cur_len = 0;
if (SUCCEEDED(buffer->Lock(&data, &max_len, &cur_len))) {
const size_t need = static_cast<size_t>(width_) * height_ * 4u;
static unsigned logged = 0;
if (logged < 3) {
TraceLog("read_frame: buffer=%lu bytes, need=%zu (%dx%d*4)",
static_cast<unsigned long>(cur_len), need, width_, height_);
++logged;
}
if (cur_len >= need) {
bgra.resize(need);
std::memcpy(bgra.data(), data, need);