Exercise production call decoder across real bitrate transitions

This commit is contained in:
evgeny committed 2026-10-14 22:46:18 +02:00
1 parent 9becdac331
commit 156b250432
1 file changed
+6
@@ -2,6 +2,7 @@
* один decoder на весь поток, непрерывные capture PTS и измеренный bitrate. */
#include <QtTest>
#include "../src/call_video_encoder.h"
#include "../src/call_video_decoder.h"
extern "C" {
#include "debug_config.h"
#include "stream/stream_media.h"
@@ -55,6 +56,7 @@ private slots:
QVERIFY(call_video_format_supported(&sender, &receiver, &config));
CallVideoEncoder encoder; QVERIFY2(encoder.open(config, 4000000), qPrintable(encoder.error()));
Decoder decoder; QVERIFY(decoder.open(codec));
CallVideoDecoder productionDecoder;
QImage image(config.width, config.height, QImage::Format_RGB32);
uint32_t random = 1; unsigned completions = 0;
for (int phase = 0; phase < 3; phase++) {
@@ -83,6 +85,10 @@ private slots:
} else QCOMPARE(completion.request, uint64_t(0));
if (phase && frame < 30) QCOMPARE(encoder.bitrate(), phase == 1 ? 4000000u : 300000u);
QVERIFY(decoder.decode(output)); QCOMPARE(decoder.frame->pts, (int64_t)pts);
call_video_frame wire{}; wire.call_id = 1; wire.frame_id = phase * 120 + frame + 1; wire.pts_us = pts;
wire.format = config; wire.size = wire.length = output.data.size(); wire.flags = output.key ? CALL_VIDEO_KEY : 0;
wire.data = reinterpret_cast<const uint8_t*>(output.data.constData());
QImage rendered; QVERIFY(productionDecoder.decode(wire, rendered)); QCOMPARE(rendered.size(), image.size());
QCOMPARE(decoder.frame->width, config.width); QCOMPARE(decoder.frame->height, config.height);
QCOMPARE(decoder.frame->format, int(AV_PIX_FMT_YUV420P)); QCOMPARE(decoder.context->has_b_frames, 0);
QCOMPARE(decoder.context->profile, codec == 1 ? AV_PROFILE_H264_CONSTRAINED_BASELINE : AV_PROFILE_HEVC_MAIN);