From b99bfd1a6110a27b03be4d2e2c000a0bf9e04566 Mon Sep 17 00:00:00 2001 From: evgeny Date: Wed, 28 Oct 2026 13:55:15 +0100 Subject: [PATCH] Apply initial stream mute before opening capture devices --- tools/chatgui/src/stream_publish_engine.cpp | 7 ++++++- tools/chatgui/src/stream_publish_engine.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/chatgui/src/stream_publish_engine.cpp b/tools/chatgui/src/stream_publish_engine.cpp index f2d94b96e..45ece1689 100644 --- a/tools/chatgui/src/stream_publish_engine.cpp +++ b/tools/chatgui/src/stream_publish_engine.cpp @@ -622,7 +622,7 @@ bool StreamPublishEngine::start(uint64_t group, const StreamPublishConfig& confi m->videoProgress("starting"); m->captureReport = 0; m->captureReportRaw = m->captureReportConverted = m->captureReportEncoded = m->captureReportDelivered = 0; m->id = QRandomGenerator::global()->generate64(); if (!m->id) m->id = 1; - m->group = group; m->audio.reset(); m->audioSequence = 0; m->muted = false; + m->group = group; m->audio.reset(); m->audioSequence = 0; m->muted = config.startMuted; stream_media_format format{(uint16_t)config.video.width, (uint16_t)config.video.height, (uint16_t)config.video.rotation, (uint8_t)config.video.codec, (uint8_t)(config.audio ? STREAM_MEDIA_OPUS_STEREO : 0), 1}; if (!gui_stream_publish_open(m->id, group, format)) { @@ -649,6 +649,11 @@ bool StreamPublishEngine::start(uint64_t group, const StreamPublishConfig& confi }); if (config.audio) m->audioThread = std::thread(&StreamPublishEngine::audioLoop, this); } catch (const std::system_error& error) { publicationFailed(m->id, QString::fromUtf8(error.what())); return false; } + if (config.audio && config.startMuted) { + setMuted(true); + if (!m->running) return false; + } + DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop stream initial audio enabled=%d muted=%d", config.audio, config.startMuted); if (!openSource(config)) { sourceFailed(m->generation, text("Could not open the selected capture device")); return false; } diff --git a/tools/chatgui/src/stream_publish_engine.h b/tools/chatgui/src/stream_publish_engine.h index 3f1740d0f..a17fa796d 100644 --- a/tools/chatgui/src/stream_publish_engine.h +++ b/tools/chatgui/src/stream_publish_engine.h @@ -38,6 +38,7 @@ struct StreamPublishConfig { LiveVideoConfig video; // Параметры encoder; поддерживаемый codec, fps 1..60, размеры в допустимом диапазоне encoder. QString microphone; // Стабильный id устройства SoundManager; пустой — default. Меняется только до start. bool audio = true; // Открыть микрофон и stereo Opus 48кГц/128кбит/с; во время публикации меняется только mute. + bool startMuted = false; // Начальный mute применяется до запуска capture; дальнейшее переключение через setMuted(). bool showCursor = true; // Учитывается поддерживаемым screen backend; portal разрешает выбор только до открытия сессии. bool nativeSize = false, automaticBitrate = false; // Screen: исходные размеры до 4096 и пересчёт bitrate при уточнении размера. bool adaptiveQp = false; // При перерасходе битрейта плавно повышать потолок выше video.maxQp, затем возвращать.