From 5e38e5b71d86a869d5f55cf81f0cfa68ed244057 Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 19 Oct 2026 19:24:07 +0200 Subject: [PATCH] Use minimal timer access and diagnose failed video image transforms --- tools/chatgui/src/call_video_decoder.cpp | 5 ++++- tools/chatgui/src/call_video_wake.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/chatgui/src/call_video_decoder.cpp b/tools/chatgui/src/call_video_decoder.cpp index 85ad5cb1..24b672f4 100644 --- a/tools/chatgui/src/call_video_decoder.cpp +++ b/tools/chatgui/src/call_video_decoder.cpp @@ -188,7 +188,10 @@ int CallVideoDecoder::receive(call_video_frame& f, QImage& image) { uint8_t* planes[4] = {output.bits(), nullptr, nullptr, nullptr}; int strides[4] = {(int)output.bytesPerLine(), 0, 0, 0}; if (sws_scale(m->scale, pixels->data, pixels->linesize, 0, pixels->height, planes, strides) != pixels->height) result = AVERROR_INVALIDDATA; - else image = f.format.rotation ? output.transformed(QTransform().rotate(f.format.rotation)) : output; + else { + image = f.format.rotation ? output.transformed(QTransform().rotate(f.format.rotation)) : output; + if (image.isNull()) result = AVERROR(ENOMEM); + } } } av_frame_free(&copied); av_frame_free(&decoded); diff --git a/tools/chatgui/src/call_video_wake.h b/tools/chatgui/src/call_video_wake.h index b2304e73..6cb74426 100644 --- a/tools/chatgui/src/call_video_wake.h +++ b/tools/chatgui/src/call_video_wake.h @@ -27,7 +27,8 @@ public: CallVideoWake() { #ifdef _WIN32 event = CreateEventW(nullptr, FALSE, FALSE, nullptr); - timer = CreateWaitableTimerExW(nullptr, nullptr, 0x00000002, TIMER_ALL_ACCESS); + constexpr DWORD highResolution = 0x00000002; // CREATE_WAITABLE_TIMER_HIGH_RESOLUTION (Windows 10 1803+). + timer = CreateWaitableTimerExW(nullptr, nullptr, highResolution, TIMER_MODIFY_STATE | SYNCHRONIZE); if (!timer) { DEBUG_WARN(DEBUG_CATEGORY_CALL, "video high resolution timer unavailable error=%lu; using regular timer", GetLastError()); timer = CreateWaitableTimerW(nullptr, FALSE, nullptr);