From 96e8f6c0ac44bb291471e5b88ab257a6ba36b07c Mon Sep 17 00:00:00 2001 From: evgeny Date: Wed, 14 Oct 2026 23:13:25 +0200 Subject: [PATCH] Test real decoder fixtures and malformed video parameter sets --- src/Makefile.am | 1 + tests/test_call_video.c | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 5d0af31e..d2fe589d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -188,6 +188,7 @@ utun_CORE_SOURCES = \ call/call_video.c \ call/call_video_bitstream.c \ call/call_video_bitstream.h \ + call/call_video_fixtures.h \ call/call_video.h \ call/call_video_transport.c \ call/call_video_transport.h \ diff --git a/tests/test_call_video.c b/tests/test_call_video.c index 8c93395e..e22021c3 100644 --- a/tests/test_call_video.c +++ b/tests/test_call_video.c @@ -1,4 +1,5 @@ #include "call/call_video.h" +#include "call/call_video_bitstream.h" #include "debug_config.h" #include #include @@ -134,7 +135,28 @@ static void rejected(void) { call_video_receiver_destroy(r); puts("video: gap, timeout, replay, malformed KEY, truncated/oversized packets, atomic parse PASS"); } +static void bitstreams(void) { + uint8_t bytes[8192]; struct call_video_bitstream s; + for (int codec = 1; codec <= 2; ++codec) { + for (int profile = 1; profile <= (codec == 1 ? 2 : 1); ++profile) { + int size = call_video_probe_key(codec, profile, bytes, sizeof(bytes)); CHECK(size > 0); + CHECK(!call_video_inspect_key(codec, bytes, size, &s)); + CHECK(s.width == 1280 && s.height == 720 && s.profile == (unsigned)profile && s.level == (codec == 1 ? 31u : 93u)); + CHECK(s.dpb >= 3); + struct call_video_format f = {1, 1280, 720, 30, 0, codec, s.level, 4000000, profile}; + CHECK(!call_video_check_key(&f, bytes, size)); + f.width = 640; CHECK(call_video_check_key(&f, bytes, size) < 0); + struct call_video_bitstream saved = s; + for (int i = 0; i < 32; ++i) { + CHECK(call_video_inspect_key(codec, bytes, i, &s) < 0); + CHECK(!memcmp(&saved, &s, sizeof(s))); + } + bytes[0] = 255; CHECK(call_video_inspect_key(codec, bytes, size, &s) < 0); + } + } + puts("video: real AVC Baseline/CB and HEVC IDR, multi-picture DPB, atomic malformed parse PASS"); +} int main(void) { debug_config_init(); debug_set_level(DEBUG_LEVEL_ERROR); - capabilities(); envelopes(); roundtrip(); rejected(); return 0; + capabilities(); envelopes(); roundtrip(); rejected(); bitstreams(); return 0; }