From 45720ebaba6942d9cd7ab789acd3941002bcfef6 Mon Sep 17 00:00:00 2001 From: evgeny Date: Wed, 14 Oct 2026 21:44:16 +0200 Subject: [PATCH] Use shared live encoder types in stream publication --- tools/chatgui/src/stream_publish_engine.cpp | 8 ++++---- tools/chatgui/src/stream_publish_engine.h | 4 ++-- tools/chatgui/src/stream_publish_window.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/chatgui/src/stream_publish_engine.cpp b/tools/chatgui/src/stream_publish_engine.cpp index 08a1d31c..832e598a 100644 --- a/tools/chatgui/src/stream_publish_engine.cpp +++ b/tools/chatgui/src/stream_publish_engine.cpp @@ -82,7 +82,7 @@ StreamPublishEngine::StreamPublishEngine(QObject* parent) : QObject(parent), m(s #endif try { m->probeThread = std::thread([this] { - auto codecs = supported() ? StreamVideoEncoder::available() : QList(); + auto codecs = supported() ? LiveVideoEncoder::available() : QList(); std::lock_guard guard(m->lock); m->codecs = std::move(codecs); m->probeReady = true; }); } catch (const std::system_error& error) { @@ -415,7 +415,7 @@ void StreamPublishEngine::audioLoop() { void StreamPublishEngine::videoLoop() { #ifdef HAVE_STREAM_CAPTURE - std::unique_ptr encoder; + std::unique_ptr encoder; StreamPublishConfig encoding; QImage lastImage; uint64_t current = 0; uint32_t revision = 0; int64_t lastPts = -1, lastKey = -1000000, next = 0, report = 0; unsigned count = 0, skipped = 0; @@ -438,7 +438,7 @@ void StreamPublishEngine::videoLoop() { if (generation == m->generation) { emit configurationChanged(); emit stateChanged(text("Live")); } }); } else { - auto candidate = std::make_unique(); + auto candidate = std::make_unique(); if (!candidate->open(config.video)) { QString error = candidate->error(); QMetaObject::invokeMethod(this, [this, generation, error] { sourceFailed(generation, error); }); @@ -475,7 +475,7 @@ void StreamPublishEngine::videoLoop() { next = now + 1000000 / config.video.fps; stream_publisher_status status; bool needsKey = gui_stream_publish_status(m->id, status) && status.need_key; bool key = pts - lastKey >= 1000000 || needsKey; - QList output; + QList output; if (!encoder->encode(lastImage, std::max(lastPts + 1, pts), key, output)) { QString error = encoder->error(); QMetaObject::invokeMethod(this, [this, generation, error] { sourceFailed(generation, error); }); continue; } diff --git a/tools/chatgui/src/stream_publish_engine.h b/tools/chatgui/src/stream_publish_engine.h index 5f879613..a855cabd 100644 --- a/tools/chatgui/src/stream_publish_engine.h +++ b/tools/chatgui/src/stream_publish_engine.h @@ -8,7 +8,7 @@ #include #include #include -#include "stream_video_encoder.h" +#include "live_video_encoder.h" #include "audio_device.h" #include "audio_capture_lease.h" #include "../../../src/stream/stream_publisher.h" @@ -22,7 +22,7 @@ struct StreamVideoSource { }; struct StreamPublishConfig { StreamVideoSource source; - StreamVideoConfig video; + LiveVideoConfig video; QString microphone; bool audio = true; }; diff --git a/tools/chatgui/src/stream_publish_window.cpp b/tools/chatgui/src/stream_publish_window.cpp index c1718952..fe830086 100644 --- a/tools/chatgui/src/stream_publish_window.cpp +++ b/tools/chatgui/src/stream_publish_window.cpp @@ -120,7 +120,7 @@ void StreamPublishWindow::refreshSources() { } void StreamPublishWindow::refreshCodecs() { m_updating = true; int previous = m_codec->currentData().toInt(); m_codec->clear(); - for (int codec : m_engine->codecs()) m_codec->addItem(StreamVideoEncoder::codecName(codec), codec); + for (int codec : m_engine->codecs()) m_codec->addItem(LiveVideoEncoder::codecName(codec), codec); int index = m_codec->findData(previous); if (index >= 0) m_codec->setCurrentIndex(index); m_updating = false; synchronize(); }