Build shared live video library independently from stream publication

This commit is contained in:
evgeny committed 2026-10-14 21:44:16 +02:00
1 parent 45720ebaba
commit 43a90ff23b
2 files changed
+14 -11

No files matched your search

+7 -7
View File
@@ -8,7 +8,7 @@
#include <atomic>
#include <thread>
#include <cmath>
#include "../src/stream_video_encoder.h"
#include "../src/live_video_encoder.h"
#include "../src/stream_publish_engine.h"
#include "../src/stream_publish_window.h"
#include "../src/sound_manager.h"
@@ -77,10 +77,10 @@ class StreamPublishTest : public QObject {
Q_UNUSED(codec); Q_UNUSED(width); Q_UNUSED(height); Q_UNUSED(pts);
return QByteArray(4, '\0') + "opaque access unit";
#else
StreamVideoEncoder encoder; StreamVideoConfig config; config.width = width; config.height = height; config.codec = codec;
LiveVideoEncoder encoder; LiveVideoConfig config; config.width = width; config.height = height; config.codec = codec;
if (!encoder.open(config)) return {};
QImage image(width, height, QImage::Format_RGB32); image.fill(QColor(45, 130, 220));
QList<StreamEncodedFrame> output;
QList<LiveEncodedFrame> output;
if (!encoder.encode(image, pts, true, output) || output.isEmpty() || !output.front().key) return {};
return output.front().data;
#endif
@@ -126,9 +126,9 @@ private slots:
}
void encoderRoundTrip_data() {
QTest::addColumn<int>("codec");
auto codecs = StreamVideoEncoder::available();
auto codecs = LiveVideoEncoder::available();
if (codecs.isEmpty()) QTest::newRow("unavailable") << 0;
for (int codec : codecs) QTest::newRow(qPrintable(StreamVideoEncoder::codecName(codec))) << codec;
for (int codec : codecs) QTest::newRow(qPrintable(LiveVideoEncoder::codecName(codec))) << codec;
}
void encoderRoundTrip() {
#ifdef HAVE_FFMPEG
@@ -174,10 +174,10 @@ private slots:
}
void liveSoftwareBitrateKeepsDecoder() {
#ifdef HAVE_FFMPEG
StreamVideoEncoder encoder; StreamVideoConfig config; config.width = config.height = 16;
LiveVideoEncoder encoder; LiveVideoConfig config; config.width = config.height = 16;
QVERIFY(encoder.open(config));
if (encoder.name() != "libx264") QSKIP("The available hardware encoder uses video-only replacement for bitrate changes");
QImage image(16, 16, QImage::Format_RGB32); image.fill(Qt::red); QList<StreamEncodedFrame> output;
QImage image(16, 16, QImage::Format_RGB32); image.fill(Qt::red); QList<LiveEncodedFrame> output;
QVERIFY(encoder.encode(image, 100000, true, output)); QVERIFY(!output.isEmpty() && output.front().key);
const uint8_t *configuration, *frame; size_t configLength, frameLength;
auto first = output.front().data;