Restore bitrate controls and wait for explicit portal source selection

This commit is contained in:
evgeny committed 2026-10-14 02:58:45 +02:00
1 parent d934978fb2
commit 386998598e
3 files changed
+17 -7

No files matched your search

+8 -5
View File
@@ -194,7 +194,7 @@ bool StreamPublishEngine::start(uint64_t group, const StreamPublishConfig& confi
if (!supported() || !codecs().contains(config.video.codec)) { emit errorOccurred(text("Video capture or encoder is unavailable")); return false; }
if (config.audio && !m_microphone.acquire()) {
DEBUG_WARN(DEBUG_CATEGORY_STREAM, "desktop publication blocked: microphone owned by another operation");
emit errorOccurred(text("The microphone is used by a call, radio or recording")); return false;
emit errorOccurred(text("The microphone is used by another operation")); return false;
}
{ std::lock_guard<std::mutex> guard(m->lock);
m->wanted = config; m->good = {}; m->hasGood = m->rollingBack = false; m->generation++; m->confirmedGeneration = 0;
@@ -214,7 +214,8 @@ bool StreamPublishEngine::start(uint64_t group, const StreamPublishConfig& confi
if (!openSource(config) || (config.audio && !openMicrophone())) {
sourceFailed(m->generation, text("Could not open the selected capture device")); return false;
}
emit stateChanged(text("Starting stream…")); emit configurationChanged(); return true;
emit stateChanged(config.source.id == "portal" ? text("Select a screen or window in the system dialog") : text("Starting stream…"));
emit configurationChanged(); return true;
}
bool StreamPublishEngine::reconfigure(const StreamPublishConfig& config) {
@@ -453,9 +454,11 @@ void StreamPublishEngine::tick() {
emit stateChanged(text("Stopped")); emit configurationChanged(); return;
}
if (m->running) {
bool confirmed; int64_t started;
{ std::lock_guard<std::mutex> guard(m->lock); confirmed = m->confirmedGeneration == m->generation; started = m->started; }
if (!confirmed && monotonicUs() - started > 8000000) sourceFailed(m->generation, text("Timed out waiting for the first video frame"));
bool confirmed, waitingSelection; int64_t started;
{ std::lock_guard<std::mutex> guard(m->lock); confirmed = m->confirmedGeneration == m->generation; started = m->started;
waitingSelection = m->wanted.source.id == "portal" && m->framePts < 0; }
if (!confirmed && !waitingSelection && monotonicUs() - started > 8000000)
sourceFailed(m->generation, text("Timed out waiting for the first video frame"));
if (m->wanted.audio && m_capture.needsRecovery()) { m_capture.close(); m_capture.retryLater(); }
if (m->wanted.audio && m_capture.retryReady()) openMicrophone();
}