Browse Source

Apply measured screen geometry through the GUI configuration path

master
evgeny 2 days ago
parent
commit
218249f9a5
  1. 18
      tools/chatgui/src/stream_publish_engine.cpp
  2. 3
      tools/chatgui/translations/chatgui_ru.ts

18
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<std::mutex> 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<std::mutex> 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<std::mutex> lock(m->lock); m->wake.wait_for(lock, std::chrono::milliseconds(5)); continue;

3
tools/chatgui/translations/chatgui_ru.ts

@ -28,6 +28,9 @@
<message><source>Video frame conversion failed</source><translation>Не удалось преобразовать видеокадр</translation></message>
<message><source>Video source</source><translation>Источник видео</translation></message>
<message><source>Video mode</source><translation>Разрешение и частота кадров</translation></message>
<message><source>Original resolution · %1 fps</source><translation>Исходное разрешение · %1 кадр/с</translation></message>
<message><source>No supported video modes</source><translation>Нет поддерживаемых режимов видео</translation></message>
<message><source>Frame rate is limited by the camera and the selected stream mode</source><translation>Частота кадров ограничена возможностями камеры и выбранным режимом трансляции</translation></message>
<message><source>Video codec</source><translation>Видеокодек</translation></message>
<message><source>Video bitrate</source><translation>Битрейт видео</translation></message>
<message><source>Automatic</source><translation>Автоматически</translation></message>

Loading…
Cancel
Save