Populate call resolutions from camera modes and test Full HD IPC
This commit is contained in:
1 parent
eb11d2ebc5
commit
7a0bc9516c
3 files changed
+60
-12
No files matched your search
@@ -71,7 +71,9 @@ public:
|
||||
raw.setStartTime(call_video_playout_now_us()); emit frame(raw);
|
||||
});
|
||||
}
|
||||
CallCameraDevices devices() override { return {{QStringLiteral("Test camera"), "red"}}; }
|
||||
CallCameraDevices devices() override {
|
||||
return {{QStringLiteral("Test camera"), "red", {{QSize(1920, 1080), 30}, {QSize(1280, 720), 30}, {QSize(640, 480), 30}}}};
|
||||
}
|
||||
bool start(const QByteArray& id, int w, int h) override {
|
||||
device = id; width = w; height = h; record("start:" + id);
|
||||
if (id == "start-stall") QThread::sleep(60);
|
||||
@@ -125,27 +127,35 @@ private slots:
|
||||
QVERIFY(fps >= 25.0); QVERIFY(fps <= 31.0); QCOMPARE(errors.size(), 0);
|
||||
const qint64 child = pid(); capture.reset(); QTRY_VERIFY_WITH_TIMEOUT(!alive(child), 3000);
|
||||
}
|
||||
void latestFrameAndGeneration_data() {
|
||||
QTest::addColumn<QSize>("size");
|
||||
QTest::newRow("720p") << QSize(1280, 720);
|
||||
QTest::newRow("1080p") << QSize(1920, 1080);
|
||||
}
|
||||
void latestFrameAndGeneration() {
|
||||
QFETCH(QSize, size);
|
||||
auto capture = std::make_unique<CallCameraCapture>();
|
||||
unsigned frames = 0; qint64 maxAge = 0; QColor color; bool expectBlue = false, wrongGeneration = false;
|
||||
connect(capture.get(), &CallCameraCapture::frameReady, this, [&](const QImage& image, qint64 pts, qint64) {
|
||||
QCOMPARE(image.size(), size);
|
||||
QCOMPARE(image.pixelColor(image.width() - 1, image.height() - 1), image.pixelColor(0, 0));
|
||||
++frames; maxAge = std::max(maxAge, call_video_playout_now_us() - pts); color = image.pixelColor(0, 0);
|
||||
if (expectBlue && color != QColor(Qt::blue)) wrongGeneration = true;
|
||||
});
|
||||
QSignalSpy errors(capture.get(), &CallCameraCapture::failed);
|
||||
capture->configure(true, "red", 1280, 720);
|
||||
capture->configure(true, "red", size.width(), size.height());
|
||||
{ Heartbeat heartbeat;
|
||||
QTRY_VERIFY_WITH_TIMEOUT(frames >= 15, 4000);
|
||||
qInfo("camera 720p latency max=%lldus GUI gap=%lldms", (long long)maxAge, (long long)heartbeat.maximum);
|
||||
qInfo("camera %dx%d latency max=%lldus GUI gap=%lldms", size.width(), size.height(), (long long)maxAge, (long long)heartbeat.maximum);
|
||||
QVERIFY(maxAge < 100000); QVERIFY(heartbeat.maximum < 150); }
|
||||
QCOMPARE(color, QColor(Qt::red));
|
||||
// Пока GUI занят, разрешён лишь один передаваемый кадр; после паузы берётся свежий.
|
||||
QThread::msleep(350); const unsigned before = frames;
|
||||
expectBlue = true;
|
||||
capture->configure(true, "blue", 1280, 720);
|
||||
capture->configure(true, "blue", size.width(), size.height());
|
||||
QTRY_VERIFY_WITH_TIMEOUT(frames > before && color == QColor(Qt::blue), 2000);
|
||||
QVERIFY(!wrongGeneration);
|
||||
const unsigned stopped = frames; capture->configure(false, "blue", 1280, 720);
|
||||
const unsigned stopped = frames; capture->configure(false, "blue", size.width(), size.height());
|
||||
QTest::qWait(150); QCOMPARE(frames, stopped); QCOMPARE(errors.size(), 0);
|
||||
const qint64 child = pid(); QVERIFY(child > 0); capture.reset(); QTRY_VERIFY_WITH_TIMEOUT(!alive(child), 3000);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user