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
@@ -30,6 +30,8 @@ extern "C" {
|
||||
}
|
||||
#ifdef HAVE_STREAM_CAPTURE
|
||||
#include <QWindowCapture>
|
||||
#include <QVideoWidget>
|
||||
#include <QVideoSink>
|
||||
#endif
|
||||
|
||||
#ifdef TEST_NULL_AUDIO
|
||||
@@ -200,6 +202,12 @@ private slots:
|
||||
}
|
||||
QVERIFY(epoch); QVERIFY(gui_stream_open(202, group, inst->node_id, epoch));
|
||||
StreamRecord out; QVERIFY(record(202, StreamRecordKind::Opened, out)); QVERIFY(record(202, StreamRecordKind::Video, out));
|
||||
auto* sink = engine.findChild<QVideoSink*>(); QVERIFY(sink);
|
||||
// Неподвижный экран на backend, выдающем кадры только при изменениях: новых raw callbacks нет.
|
||||
QObject::disconnect(sink, nullptr, &engine, nullptr);
|
||||
StreamPublishWindow controls(&engine, group); controls.show();
|
||||
auto* preview = controls.findChild<QVideoWidget*>(); QVERIFY(preview);
|
||||
QTRY_VERIFY(preview->videoSink()->videoFrame().isValid()); controls.close(); QVERIFY(engine.running());
|
||||
uint64_t first = out.pts; unsigned audio = 0, video = 0; uint64_t latest = first, left = 0, right = 0;
|
||||
auto* decoder = opus_codec_decoder_create(48000, 2); QVERIFY(decoder);
|
||||
QElapsedTimer elapsed; elapsed.start();
|
||||
@@ -222,11 +230,21 @@ private slots:
|
||||
QTest::qWait(1);
|
||||
}
|
||||
QVERIFY(revised); QCOMPARE(out.format.rotation, (uint16_t)90);
|
||||
auto invalid = next; invalid.video.fps = 61;
|
||||
QVERIFY(engine.reconfigure(invalid));
|
||||
QTRY_COMPARE_WITH_TIMEOUT(engine.config().video.fps, 15, 5000);
|
||||
QTRY_COMPARE(errors.size(), 1); errors.clear();
|
||||
bool restored = false;
|
||||
elapsed.restart(); while (!restored && elapsed.elapsed() < 5000) {
|
||||
if (gui_stream_pull(202, out, 0, 60000000, 60000000) && out.kind == StreamRecordKind::Video && out.format.revision >= 3) restored = true;
|
||||
QTest::qWait(1);
|
||||
}
|
||||
QVERIFY(restored);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||
next.source = {StreamVideoSource::Window, pattern.windowTitle(), {}, QVariant::fromValue(QCapturableWindow(pattern.windowHandle()))};
|
||||
QVERIFY(engine.reconfigure(next)); bool window = false;
|
||||
elapsed.restart(); while (!window && elapsed.elapsed() < 5000) {
|
||||
if (gui_stream_pull(202, out, 0, 60000000, 60000000) && out.kind == StreamRecordKind::Video && out.format.revision >= 3) window = true;
|
||||
if (gui_stream_pull(202, out, 0, 60000000, 60000000) && out.kind == StreamRecordKind::Video && out.format.revision >= 4) window = true;
|
||||
QTest::qWait(1);
|
||||
}
|
||||
QVERIFY(window);
|
||||
|
||||
Reference in new issue
Block a user