Add log info

This commit is contained in:
2026-04-03 15:16:26 +11:00
parent 6fb09830c5
commit c2f30b18ab
2 changed files with 33 additions and 9 deletions

View File

@@ -1103,18 +1103,22 @@ extern "C" __declspec(dllexport) int GetRTSPCVImage(
RTSP_DBG("[GetRTSPCVImage] SKIP CUDA — player not playing (reconnecting?)");
}
// Lightweight timing via spdlog (no OutputDebugString).
// Logs only when the frame grab + D2D exceeds 50ms — helps diagnose stalls
// without the overhead of per-frame debug logging.
// Lightweight timing — logs only when frame grab + D2D exceeds 50ms.
// Goes to both spdlog (console/file) AND OutputDebugString (DebugView)
// but ONLY for slow frames, so the overhead is negligible (<1 call/sec
// under normal conditions vs 500+/sec with full debug logging).
auto t2 = std::chrono::steady_clock::now();
double getImageMs = std::chrono::duration<double, std::milli>(t1 - t0).count();
double cudaMs = std::chrono::duration<double, std::milli>(t2 - t1).count();
double totalMs = getImageMs + cudaMs;
if (totalMs > 50.0) {
(*Handle)->_logger.LogWarn("GetRTSPCVImage",
std::format("SLOW FRAME: total={:.1f}ms (getImage={:.1f}ms cuda={:.1f}ms) {}x{}",
totalMs, getImageMs, cudaMs, width, height),
__FILE__, __LINE__);
auto msg = std::format("SLOW FRAME: total={:.1f}ms (getImage={:.1f}ms cuda={:.1f}ms) {}x{}",
totalMs, getImageMs, cudaMs, width, height);
(*Handle)->_logger.LogWarn("GetRTSPCVImage", msg, __FILE__, __LINE__);
#ifdef _WIN32
auto dbg = std::format("[GetRTSPCVImage] {}\n", msg);
OutputDebugStringA(dbg.c_str());
#endif
}
return 1; // Success