Verify actual bitstreams through asynchronous decoder API and CPU encoder fallback
This commit is contained in:
1 parent
5f45b38cfb
commit
f9348ce36f
2 files changed
+20
-11
No files matched your search
@@ -1,5 +1,5 @@
|
||||
/* Настоящие software bitstream/decoder под GPU-границей FFmpeg: задержка, пачки,
|
||||
* PTS QSV 90kHz, AMF с периодическим IDR, отказ замены и запрет CPU fallback.
|
||||
* PTS QSV 90kHz, AMF с периодическим IDR, отказ замены и автоматический CPU fallback.
|
||||
* Драйвер не эмулируется: тест проверяет конвейер приложения, аппаратные прогоны нужны отдельно. */
|
||||
#include "../src/call_video_encoder.h"
|
||||
#include "../src/call_video_decoder.h"
|
||||
@@ -111,14 +111,18 @@ private slots:
|
||||
void initTestCase() { debug_config_init(); debug_set_level(DEBUG_LEVEL_WARN); av_log_set_level(AV_LOG_ERROR); }
|
||||
void init() { selected.clear(); opened = software = 0; depth = 1; burst = badReplacement = badProbe = false; QVERIFY(contexts.empty()); }
|
||||
void cleanup() { QVERIFY(contexts.empty()); }
|
||||
void gpuOnly() {
|
||||
void explicitGpuOnly() {
|
||||
CallVideoEncoder encoder; call_video_format format{1, 640, 360, 30, 0, 1, 31, 4000000, 2};
|
||||
QVERIFY(!encoder.open(format, 1000000)); QCOMPARE(software, 0u);
|
||||
QVERIFY(!encoder.open(format, 1000000, "h264_nvenc")); QCOMPARE(software, 0u);
|
||||
}
|
||||
void cpuFallback() {
|
||||
CallVideoEncoder encoder; call_video_format format{1, 640, 360, 30, 0, 1, 31, 4000000, 2};
|
||||
QVERIFY2(encoder.open(format, 1000000), qPrintable(encoder.error())); QVERIFY(software > 0);
|
||||
}
|
||||
void incompatibleProbe() {
|
||||
selected = "hevc_amf"; badProbe = true;
|
||||
CallVideoEncoder encoder; call_video_format format{1, 640, 360, 30, 0, 2, 93, 4000000, 1};
|
||||
QVERIFY(!encoder.open(format, 1000000));
|
||||
QVERIFY(!encoder.open(format, 1000000, "hevc_amf"));
|
||||
QVERIFY2(encoder.error().contains("call bitstream contract"), qPrintable(encoder.error()));
|
||||
QCOMPARE(software, 0u);
|
||||
}
|
||||
@@ -131,11 +135,12 @@ private slots:
|
||||
QVERIFY(encoder.encode(image, 1000000, true, output, completion));
|
||||
QVERIFY(encoder.encode(image, 1033333, false, output, completion));
|
||||
QCOMPARE(output.size(), 1); QCOMPARE(output.front().pts, uint64_t(1000000));
|
||||
CallVideoDecoder decoder; unsigned decodedCount = 0;
|
||||
CallVideoDecoder decoder(CallVideoDecoder::Backend::SoftwareOnly); unsigned decodedCount = 0;
|
||||
auto decode = [&](const LiveEncodedFrame& f) {
|
||||
call_video_frame wire{}; wire.call_id = 1; wire.frame_id = ++decodedCount; wire.pts_us = f.pts; wire.format = format;
|
||||
wire.data = reinterpret_cast<const uint8_t*>(f.data.constData()); wire.size = wire.length = f.data.size();
|
||||
wire.flags = f.key ? CALL_VIDEO_KEY : 0; QImage decoded; return decoder.decode(wire, decoded);
|
||||
wire.flags = f.key ? CALL_VIDEO_KEY : 0; QImage decoded; call_video_frame result{};
|
||||
return decoder.submit(wire) == 1 && decoder.receive(result, decoded) == 1 && result.pts_us == wire.pts_us;
|
||||
};
|
||||
QVERIFY(decode(output.front())); depth = 8; // GPU временно перестал выдавать output.
|
||||
for (unsigned i = 2; i < 9; ++i) {
|
||||
@@ -189,7 +194,8 @@ private slots:
|
||||
call_video_frame wire{}; wire.call_id = 1; wire.frame_id = ++shown; wire.pts_us = frame.pts;
|
||||
wire.format = format; wire.size = wire.length = frame.data.size(); wire.flags = frame.key ? CALL_VIDEO_KEY : 0;
|
||||
wire.data = reinterpret_cast<const uint8_t*>(frame.data.constData());
|
||||
QImage decoded; QVERIFY(decoder.decode(wire, decoded));
|
||||
QImage decoded; call_video_frame result{};
|
||||
QCOMPARE(decoder.submit(wire), 1); QCOMPARE(decoder.receive(result, decoded), 1); QCOMPARE(result.pts_us, wire.pts_us);
|
||||
last = frame.pts;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user