Reuse static screen frames across encoder changes and test rollback
This commit is contained in:
1 parent
c08415a255
commit
e4f9a48c2c
2 files changed
+21
-3
No files matched your search
@@ -133,7 +133,7 @@ bool StreamPublishEngine::openSource(const StreamPublishConfig& config) {
|
||||
uint64_t generation;
|
||||
{ std::lock_guard<std::mutex> guard(m->lock); generation = ++m->sourceGeneration;
|
||||
m->backendOrigin = m->backendAnchor = -1; m->capturedFrames = 0; }
|
||||
m->session = std::make_unique<QMediaCaptureSession>(); m->sink = std::make_unique<QVideoSink>();
|
||||
m->session = std::make_unique<QMediaCaptureSession>(); m->sink = std::make_unique<QVideoSink>(this);
|
||||
m->session->setVideoSink(m->sink.get());
|
||||
connect(m->sink.get(), &QVideoSink::videoFrameChanged, this, [this, generation](const QVideoFrame& frame) {
|
||||
if (!frame.isValid()) { DEBUG_TRACE(DEBUG_CATEGORY_VIDEO, "desktop capture sink invalid frame generation=%llu", (unsigned long long)generation); return; }
|
||||
@@ -430,7 +430,7 @@ void StreamPublishEngine::videoLoop() {
|
||||
}
|
||||
bool screen = config.source.kind != StreamVideoSource::Camera;
|
||||
if (frame.isValid()) {
|
||||
if (capture <= lastPts || monotonicUs() - m->origin - capture > 250000) { skipped++; continue; }
|
||||
if (!screen && (capture <= lastPts || monotonicUs() - m->origin - capture > 250000)) { skipped++; continue; }
|
||||
lastImage = frame.toImage();
|
||||
if (lastImage.isNull()) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_VIDEO, "desktop captured frame conversion failed format=%d", frame.pixelFormat());
|
||||
|
||||
Reference in new issue
Block a user