|
|
|
|
@ -78,10 +78,10 @@ class StreamViewTest : public QObject {
|
|
|
|
|
uint32_t revision = 1; |
|
|
|
|
uint16_t rotation = 90; |
|
|
|
|
|
|
|
|
|
bool receive(uint64_t id, StreamRecord& record) { |
|
|
|
|
bool receive(uint64_t id, StreamRecord& record, int64_t position = -1) { |
|
|
|
|
QElapsedTimer elapsed; elapsed.start(); |
|
|
|
|
while (elapsed.elapsed() < 1000) { |
|
|
|
|
if (gui_stream_pull(id, record)) return true; |
|
|
|
|
if (gui_stream_pull(id, record, position)) return true; |
|
|
|
|
QTest::qWait(1); |
|
|
|
|
} |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "desktop test missing record id=%llu", (unsigned long long)id); return false; |
|
|
|
|
@ -151,16 +151,26 @@ private slots:
|
|
|
|
|
QCOMPARE(event.format.rotation, uint16_t(90)); |
|
|
|
|
QVERIFY(receive(102, event)); QCOMPARE(event.kind, StreamRecordKind::Audio); QCOMPARE(event.data, audio); |
|
|
|
|
for (int i = 0; i < 270; i++) { publish(frame); uasync_poll(ua, 0); } |
|
|
|
|
bool gap = false; unsigned records = 0; |
|
|
|
|
while (gui_stream_pull(102, event)) { gap |= event.kind == StreamRecordKind::Gap; records++; } |
|
|
|
|
QVERIFY(gap); QVERIFY(records <= 256); |
|
|
|
|
publish(frame); QVERIFY(receive(102, event)); QCOMPARE(event.kind, StreamRecordKind::Video); |
|
|
|
|
unsigned records = 0; |
|
|
|
|
QElapsedTimer held; held.start(); |
|
|
|
|
while (held.elapsed() < 30) { |
|
|
|
|
if (gui_stream_pull(102, event, 100000, 0, 0)) { QVERIFY(event.kind != StreamRecordKind::Gap); records++; } |
|
|
|
|
QTest::qWait(1); |
|
|
|
|
} |
|
|
|
|
QVERIFY(records <= 2); /* Накопленные 27 секунд остаются в RS, а не в очереди frontend. */ |
|
|
|
|
QVERIFY(receive(102, event, 200000)); QCOMPARE(event.kind, StreamRecordKind::Video); |
|
|
|
|
QCOMPARE(event.pts, uint64_t(200000)); QCOMPARE(event.data, frame); |
|
|
|
|
gui_stream_stop(102); QTest::qWait(20); |
|
|
|
|
stream_info info{}; QCOMPARE(stream_get_info(publisher, &info), STREAM_OK); QCOMPARE(info.owners, 1u); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void realH264RenderingAndClose() { |
|
|
|
|
#ifdef HAVE_FFMPEG |
|
|
|
|
/* Фикстура протокола выше содержит фиктивный H264; реальный decoder получает отдельную эпоху. */ |
|
|
|
|
QCOMPARE(stream_publish_finish(publisher), STREAM_OK); stream_close(publisher); publisher = nullptr; |
|
|
|
|
QCOMPARE(stream_publish_open(inst, group, nullptr, &publisher), STREAM_OK); |
|
|
|
|
stream_info fresh{}; QCOMPARE(stream_get_info(publisher, &fresh), STREAM_OK); epoch = fresh.descriptor.source_epoch; |
|
|
|
|
mediaPts = 0; frameId = 0; revision = 1; |
|
|
|
|
const AVCodec* encoder = avcodec_find_encoder(AV_CODEC_ID_H264); |
|
|
|
|
if (!encoder) QSKIP("H264 encoder is unavailable for the decoder fixture"); |
|
|
|
|
AVCodecContext* context = avcodec_alloc_context3(encoder); QVERIFY(context); |
|
|
|
|
|