Exercise real Full HD codecs and camera buffer boundaries

This commit is contained in:
evgeny committed 2026-10-19 22:46:35 +02:00
1 parent 8943324137
commit d1fc15e553
2 files changed
+19 -7

No files matched your search

@@ -130,8 +130,8 @@ private slots:
auto caps = CallVideoDecoder::capabilities();
QCOMPARE(caps.decode[0].profiles, uint8_t(3)); QCOMPARE(caps.decode[1].profiles, uint8_t(1));
for (const auto& limit : caps.decode) {
QCOMPARE(limit.width, uint16_t(1280)); QCOMPARE(limit.height, uint16_t(1280));
QCOMPARE(limit.pixels_per_second, uint32_t(1280 * 720 * 30));
QCOMPARE(limit.width, uint16_t(1920)); QCOMPARE(limit.height, uint16_t(1920));
QCOMPARE(limit.pixels_per_second, uint32_t(1920 * 1080 * 30));
}
QCOMPARE(caps.encode[0].width, uint16_t(0)); QCOMPARE(caps.encode[1].width, uint16_t(0));
const QString directory = qEnvironmentVariable("UTUN_CALL_VIDEO_REMOTE_DIR");
@@ -155,26 +155,30 @@ private slots:
}
}
void bothOrientations_data() {
QTest::addColumn<int>("codec"); QTest::newRow("H264") << 1; QTest::newRow("H265") << 2;
QTest::addColumn<int>("codec"); QTest::addColumn<bool>("fullhd");
QTest::newRow("H264-720p") << 1 << false; QTest::newRow("H265-720p") << 2 << false;
QTest::newRow("H264-1080p") << 1 << true; QTest::newRow("H265-1080p") << 2 << true;
}
void bothOrientations() {
QFETCH(int, codec);
QFETCH(int, codec); QFETCH(bool, fullhd);
const char* backend = codec == 1 ? "libx264" : "libx265";
if (!avcodec_find_encoder_by_name(backend)) QSKIP("Software encoder unavailable");
auto config = configuration(codec);
const uint16_t width = fullhd ? 1920 : 1280, height = fullhd ? 1080 : 720;
config.level = codec == 1 ? (fullhd ? 40 : 31) : (fullhd ? 120 : 93);
auto receiver = CallVideoDecoder::capabilities();
call_video_caps sender{};
call_video_limit limit{1280, 720, 30, 1280 * 720 * 30, 4000000, config.profile, config.level};
call_video_limit limit{width, height, 30, uint32_t(width) * height * 30, 4000000, config.profile, config.level};
// Обе пробы используют production open с проверкой настоящего KEY.
for (bool portrait : {false, true}) {
config.width = portrait ? 720 : 1280; config.height = portrait ? 1280 : 720;
config.width = portrait ? height : width; config.height = portrait ? width : height;
CallVideoEncoder probe; QVERIFY2(probe.open(config, 1000000, backend), qPrintable(probe.error()));
}
QVERIFY(!call_video_limit_orientations(&limit, codec)); sender.encode[codec - 1] = limit;
CallVideoDecoder decoder(CallVideoDecoder::Backend::SoftwareOnly);
uint64_t pts = 1000000, frameId = 0;
for (bool portrait : {false, true, false}) {
config.width = portrait ? 720 : 1280; config.height = portrait ? 1280 : 720;
config.width = portrait ? height : width; config.height = portrait ? width : height;
config.generation++; config.level = 0;
QCOMPARE(call_video_choose(&sender, &receiver, &config), codec);
QVERIFY(call_video_format_supported(&sender, &receiver, &config));