Apply initial stream mute before opening capture devices

This commit is contained in:
evgeny committed 2026-10-28 13:55:15 +01:00
1 parent 1251a5226e
commit b99bfd1a61
2 files changed
+7 -1

No files matched your search

+6 -1
View File
@@ -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;
}
@@ -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, затем возвращать.