From 218249f9a558ba0b7b24d7918703f5cfeb8be038 Mon Sep 17 00:00:00 2001 From: evgeny Date: Fri, 16 Oct 2026 13:54:40 +0200 Subject: [PATCH] Apply measured screen geometry through the GUI configuration path --- tools/chatgui/src/stream_publish_engine.cpp | 18 +++++++++--------- tools/chatgui/translations/chatgui_ru.ts | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tools/chatgui/src/stream_publish_engine.cpp b/tools/chatgui/src/stream_publish_engine.cpp index 31703bc7..f5bde8bd 100644 --- a/tools/chatgui/src/stream_publish_engine.cpp +++ b/tools/chatgui/src/stream_publish_engine.cpp @@ -459,19 +459,19 @@ void StreamPublishEngine::videoLoop(StreamPublishConfig initial) { QMetaObject::invokeMethod(this, [this, generation] { sourceFailed(generation, text("Invalid stream video dimensions")); }); continue; } - std::lock_guard guard(m->lock); - if (m->generation != generation) continue; config.source.size = frame.size(); - if (config.video.width != size.width() || config.video.height != size.height()) { - config.video.width = size.width(); config.video.height = size.height(); - if (config.automaticBitrate) config.video.bitrate = std::clamp(size.width() * size.height() * config.video.fps / 11, 250000, 16000000); - generation = ++m->generation; m->frameGeneration = generation; m->started = monotonicUs(); - } - m->wanted = config; + config.video.width = size.width(); config.video.height = size.height(); + if (config.automaticBitrate) config.video.bitrate = std::clamp(size.width() * size.height() * config.video.fps / 11, 250000, 16000000); DEBUG_INFO(DEBUG_CATEGORY_VIDEO, "desktop screen size resolved source=%s raw=%dx%d target=%dx%d native=%d generation=%llu", qPrintable(config.source.name), frame.width(), frame.height(), size.width(), size.height(), config.nativeSize, (unsigned long long)generation); - QMetaObject::invokeMethod(this, [this, generation] { if (generation == m->generation) emit sourcesChanged(); }); + QMetaObject::invokeMethod(this, [this, generation, config] { + if (generation == m->generation && m->running && reconfigure(config)) emit sourcesChanged(); + }); + // GUI изменяет конфигурацию и возвращает последний preview frame уже с новым поколением. + std::unique_lock lock(m->lock); + m->wake.wait_for(lock, std::chrono::milliseconds(100), [this, generation] { return !m->running || m->generation != generation; }); + continue; } if (config.source.kind == StreamVideoSource::Screen && config.source.size.isEmpty() && !frame.isValid()) { std::unique_lock lock(m->lock); m->wake.wait_for(lock, std::chrono::milliseconds(5)); continue; diff --git a/tools/chatgui/translations/chatgui_ru.ts b/tools/chatgui/translations/chatgui_ru.ts index 9207c7d4..e5fc4a36 100644 --- a/tools/chatgui/translations/chatgui_ru.ts +++ b/tools/chatgui/translations/chatgui_ru.ts @@ -28,6 +28,9 @@ Video frame conversion failedНе удалось преобразовать видеокадр Video sourceИсточник видео Video modeРазрешение и частота кадров + Original resolution · %1 fpsИсходное разрешение · %1 кадр/с + No supported video modesНет поддерживаемых режимов видео + Frame rate is limited by the camera and the selected stream modeЧастота кадров ограничена возможностями камеры и выбранным режимом трансляции Video codecВидеокодек Video bitrateБитрейт видео AutomaticАвтоматически