Check continuing H265 screen video and avoid waiting on failed input
This commit is contained in:
1 parent
2de9ac85a2
commit
69cee1bec4
2 files changed
+18
-1
No files matched your search
@@ -281,15 +281,23 @@ private slots:
|
||||
}
|
||||
if (!screens) QSKIP("No enumerated screens");
|
||||
}
|
||||
void nativeScreenCapture_data() {
|
||||
QTest::addColumn<int>("codec");
|
||||
QTest::newRow("h264") << int(STREAM_MEDIA_H264);
|
||||
QTest::newRow("h265") << int(STREAM_MEDIA_H265);
|
||||
}
|
||||
void nativeScreenCapture() {
|
||||
#ifdef HAVE_STREAM_CAPTURE
|
||||
if (!qEnvironmentVariableIsSet("UTUN_TEST_SCREEN_CAPTURE")) QSKIP("Run with X11 screen capture enabled");
|
||||
QFETCH(int, codec);
|
||||
StreamPublishEngine engine; QTRY_VERIFY_WITH_TIMEOUT(!engine.codecs().isEmpty(), 15000);
|
||||
if (!engine.codecs().contains(codec)) QSKIP("Requested encoder unavailable");
|
||||
connect(&engine, &StreamPublishEngine::softwareEncodingRequested, &engine,
|
||||
[&engine](uint64_t generation) { engine.answerSoftwareEncoding(generation, true); });
|
||||
QSignalSpy errors(&engine, &StreamPublishEngine::errorOccurred);
|
||||
StreamPublishConfig config; config.audio = false; config.nativeSize = true; config.automaticBitrate = true;
|
||||
config.video.width = 640; config.video.height = 360; config.video.fps = 15;
|
||||
config.video.codec = codec;
|
||||
uint64_t epoch = 0; unsigned captured = 0;
|
||||
for (const auto& source : engine.sources()) {
|
||||
if (source.kind != StreamVideoSource::Screen || source.size.isEmpty()) continue;
|
||||
@@ -311,6 +319,15 @@ private slots:
|
||||
QVERIFY(matched); QCOMPARE(engine.config().source.id, source.id); QCOMPARE(engine.config().source.size, source.size);
|
||||
QCOMPARE(engine.config().video.width, expected.width()); QCOMPARE(engine.config().video.height, expected.height());
|
||||
QVERIFY(errors.isEmpty()); captured++;
|
||||
uint64_t previous = frame.pts; unsigned following = 0;
|
||||
elapsed.restart();
|
||||
while (following < 8 && elapsed.elapsed() < 12000) {
|
||||
if (gui_stream_pull(204, frame, 0, true, 60000000) && frame.kind == StreamRecordKind::Video) {
|
||||
QVERIFY(frame.pts > previous); previous = frame.pts; following++;
|
||||
}
|
||||
QTest::qWait(1);
|
||||
}
|
||||
QCOMPARE(following, 8u); // Проверяем продолжение видео, а не только появление первого KEY.
|
||||
}
|
||||
if (!captured) QSKIP("No enumerated screens");
|
||||
engine.stop(); QTRY_VERIFY_WITH_TIMEOUT(!engine.active(), 4000); gui_stream_stop(204);
|
||||
|
||||
Reference in new issue
Block a user