Verify outstanding read replies and explicit video demand
This commit is contained in:
1 parent
74c96ba5e9
commit
360a6efafc
2 files changed
+16
-5
No files matched your search
@@ -57,6 +57,17 @@ class StreamDecodePumpTest {
|
||||
catch (expected: IllegalStateException) { assertTrue(expected.message!!.contains("no output progress")) }
|
||||
}
|
||||
|
||||
@Test fun outstandingReadCanArriveAfterFutureOutputWithoutAnotherRead() {
|
||||
val codec = Codec(1)
|
||||
codec.pump.offer(Frame(100000), 0); codec.pump.step(0, 0)
|
||||
codec.pump.offer(Frame(140000), 1)
|
||||
assertFalse(codec.pump.wantsInput); codec.pump.step(0, 1)
|
||||
assertEquals(1L, codec.pump.inputCount); assertNotNull(codec.pump.input)
|
||||
codec.pump.step(100000, 100000)
|
||||
assertEquals(2L, codec.pump.inputCount); assertEquals(140000L, codec.pump.output!!.pts)
|
||||
codec.pump.step(140000, 140000); assertEquals(2, codec.released)
|
||||
}
|
||||
|
||||
@Test fun networkPauseKeepsReferencesAndAllowsIncompletePipelineToResume() {
|
||||
val codec = Codec(4)
|
||||
repeat(2) { i -> codec.pump.offer(Frame(i * 40000L), i * 40000L); codec.pump.step(0, i * 40000L) }
|
||||
|
||||
@@ -88,7 +88,7 @@ class StreamPublishTest : public QObject {
|
||||
bool record(uint64_t id, StreamRecordKind kind, StreamRecord& out) {
|
||||
QElapsedTimer elapsed; elapsed.start();
|
||||
while (elapsed.elapsed() < 2500) {
|
||||
if (gui_stream_pull(id, out, 0, 60000000, 60000000) && out.kind == kind) return true;
|
||||
if (gui_stream_pull(id, out, 0, true, 60000000) && out.kind == kind) return true;
|
||||
QTest::qWait(1);
|
||||
}
|
||||
return false;
|
||||
@@ -246,7 +246,7 @@ private slots:
|
||||
auto* decoder = opus_codec_decoder_create(48000, 2); QVERIFY(decoder);
|
||||
QElapsedTimer elapsed; elapsed.start();
|
||||
while (elapsed.elapsed() < 1800) {
|
||||
if (gui_stream_pull(202, out, 0, 60000000, 60000000)) {
|
||||
if (gui_stream_pull(202, out, 0, true, 60000000)) {
|
||||
if (out.kind == StreamRecordKind::Video) { video++; latest = out.pts; }
|
||||
if (out.kind == StreamRecordKind::Audio) {
|
||||
audio++; int16_t pcm[1920]; QCOMPARE(opus_codec_decode(decoder, (const uint8_t*)out.data.constData(), out.data.size(), pcm, 960), 960);
|
||||
@@ -261,7 +261,7 @@ private slots:
|
||||
if (engine.codecs().contains(STREAM_MEDIA_VP9)) next.video.codec = STREAM_MEDIA_VP9;
|
||||
QVERIFY(engine.reconfigure(next)); bool revised = false;
|
||||
elapsed.restart(); while (!revised && elapsed.elapsed() < 5000) {
|
||||
if (gui_stream_pull(202, out, 0, 60000000, 60000000) && out.kind == StreamRecordKind::Video && out.format.revision >= 2) revised = true;
|
||||
if (gui_stream_pull(202, out, 0, true, 60000000) && out.kind == StreamRecordKind::Video && out.format.revision >= 2) revised = true;
|
||||
QTest::qWait(1);
|
||||
}
|
||||
QVERIFY(revised); QCOMPARE(out.format.rotation, (uint16_t)90); QCOMPARE(out.format.video_codec, (uint8_t)next.video.codec);
|
||||
@@ -274,7 +274,7 @@ private slots:
|
||||
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;
|
||||
if (gui_stream_pull(202, out, 0, true, 60000000) && out.kind == StreamRecordKind::Video && out.format.revision >= 3) restored = true;
|
||||
QTest::qWait(1);
|
||||
}
|
||||
QVERIFY(restored);
|
||||
@@ -282,7 +282,7 @@ private slots:
|
||||
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 >= 4) window = true;
|
||||
if (gui_stream_pull(202, out, 0, true, 60000000) && out.kind == StreamRecordKind::Video && out.format.revision >= 4) window = true;
|
||||
QTest::qWait(1);
|
||||
}
|
||||
QVERIFY(window);
|
||||
|
||||
Reference in new issue
Block a user