|
|
|
|
@ -428,17 +428,19 @@ void StreamPublishEngine::videoLoop() {
|
|
|
|
|
if (generation == m->generation) { emit configurationChanged(); emit stateChanged(text("Live")); } |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
auto candidate = std::make_unique<StreamVideoEncoder>(); |
|
|
|
|
if (!candidate->open(config.video)) { |
|
|
|
|
QString error = candidate->error(); |
|
|
|
|
QMetaObject::invokeMethod(this, [this, generation, error] { sourceFailed(generation, error); }); |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
encoder = std::move(candidate); current = generation; encoding = config; revision++; lastImage = {}; lastKey = -1000000; |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_VIDEO, "desktop video prepared generation=%llu revision=%u encoder=%s", |
|
|
|
|
(unsigned long long)generation, revision, qPrintable(encoder->name())); |
|
|
|
|
auto candidate = std::make_unique<StreamVideoEncoder>(); |
|
|
|
|
if (!candidate->open(config.video)) { |
|
|
|
|
QString error = candidate->error(); |
|
|
|
|
QMetaObject::invokeMethod(this, [this, generation, error] { sourceFailed(generation, error); }); |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
encoder = std::move(candidate); current = generation; encoding = config; revision++; lastImage = {}; lastKey = -1000000; |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_VIDEO, "desktop video prepared generation=%llu revision=%u encoder=%s", |
|
|
|
|
(unsigned long long)generation, revision, qPrintable(encoder->name())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
bool screen = config.source.kind != StreamVideoSource::Camera; |
|
|
|
|
|