From 68e5905d9eb51cca84e5d181bc8fad2a851225b5 Mon Sep 17 00:00:00 2001 From: evgeny Date: Wed, 14 Oct 2026 23:09:51 +0200 Subject: [PATCH] Adapt call transport tests and desktop setup to profile negotiation --- tests/test_call.c | 8 ++++---- tools/chatgui/src/call_video_engine.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/test_call.c b/tests/test_call.c index 2c863651..d5c8cc28 100644 --- a/tests/test_call.c +++ b/tests/test_call.c @@ -148,7 +148,7 @@ static struct call_video_frame video_test_frame(uint64_t id, unsigned generation struct call_video_frame f = {0}; f.call_id = id; f.frame_id = generation; f.pts_us = sent_timing.pts_us + generation * 30000; f.format = (struct call_video_format){generation, 640, 480, 30, 0, - generation == 1 ? CALL_VIDEO_H265 : CALL_VIDEO_H264, generation == 1 ? 93 : 31, 4000000, 1000000}; + generation == 1 ? CALL_VIDEO_H265 : CALL_VIDEO_H264, generation == 1 ? 93 : 31, 4000000, 1}; f.flags = CALL_VIDEO_KEY; f.size = f.length = sizeof(g_video_data); f.data = g_video_data; return f; } @@ -517,7 +517,7 @@ static void call_tick(void* arg) { for (unsigned i = 4; i < sizeof(g_video_data); i++) g_video_data[i] = (uint8_t)i; struct call_video_caps caps = {0}; caps.encode[0] = caps.encode[1] = caps.decode[0] = caps.decode[1] - = (struct call_video_limit){1280, 720, 30, 1280 * 720 * 30, 4000000, 1000000, 31}; + = (struct call_video_limit){1280, 720, 30, 1280 * 720 * 30, 4000000, 1, 31}; caps.encode[1].level = caps.decode[1].level = 93; if (call_video_configure(A, t->call_id, &caps, &video_ops, (void*)0) || call_video_configure(B, t->call_id, &caps, &video_ops, (void*)1)) { t->result = 2; break; } @@ -527,10 +527,10 @@ static void call_tick(void* arg) { if (g_video_peer[0].decode[1].width != 1280 || g_video_peer[1].decode[1].width != 1280) break; struct call_video_frame f = video_test_frame(t->call_id, 1); if (call_video_configure_rate(A, t->call_id, &f.format, 800000, 400000)) { t->result = 2; break; } - struct call_video_frame invalid = f; invalid.format.vbv_bits = 1000001; + struct call_video_frame invalid = f; invalid.format.profile = 2; if (call_video_send_frame(A, &invalid) != -1 || call_video_configure_rate(A, t->call_id, &invalid.format, 800000, 400000) != -1) { - DEBUG_ERROR(DEBUG_CATEGORY_CALL, "video accepted VBV above peer limit"); t->result = 2; break; + DEBUG_ERROR(DEBUG_CATEGORY_CALL, "video accepted unsupported profile"); t->result = 2; break; } int result = call_video_send_frame(A, &f); if (result < 0) { fprintf(stderr, "video send failed\n"); t->result = 2; break; } diff --git a/tools/chatgui/src/call_video_engine.cpp b/tools/chatgui/src/call_video_engine.cpp index d69fe8c0..92c94afe 100644 --- a/tools/chatgui/src/call_video_engine.cpp +++ b/tools/chatgui/src/call_video_engine.cpp @@ -133,10 +133,11 @@ void CallVideoEngine::transmit() { call_video_caps caps{}; // Каждый объявленный codec проверяется реальным encoder + независимым decoder при open. for (unsigned codec = 1; codec <= 2 && m->running; ++codec) { - call_video_format probe{1, 1280, 720, 30, 0, (uint8_t)codec, (uint8_t)(codec == 1 ? 31 : 93), 4000000, 1000000}; + call_video_format probe{1, 1280, 720, 30, 0, (uint8_t)codec, (uint8_t)(codec == 1 ? 31 : 93), 4000000, + (uint8_t)(codec == 1 ? CALL_VIDEO_CONSTRAINED_BASELINE : CALL_VIDEO_MAIN)}; CallVideoEncoder encoder; if (encoder.open(probe, 1000000)) { - call_video_limit limit{1280, 720, 30, 1280 * 720 * 30, 4000000, 1000000, probe.level}; + call_video_limit limit{1280, 720, 30, 1280 * 720 * 30, 4000000, probe.profile, probe.level}; caps.encode[codec - 1] = caps.decode[codec - 1] = limit; } else DEBUG_WARN(DEBUG_CATEGORY_CALL, "call codec probe unavailable codec=%u: %s", codec, qPrintable(encoder.error())); } @@ -163,7 +164,7 @@ void CallVideoEngine::transmit() { if (!enabled || !state.have_peer || pts <= lastPts || (lastPts >= 0 && pts - lastPts < 33333)) { idle(); continue; } if (revision != appliedRevision) { if (lastKey >= 0 && pts - lastKey < 1000000) { idle(); continue; } - call_video_format next{format.generation + 1, (uint16_t)width, (uint16_t)height, 30, 0, (uint8_t)codec, 0, 4000000, 1000000}; + call_video_format next{format.generation + 1, (uint16_t)width, (uint16_t)height, 30, 0, (uint8_t)codec, 0, 4000000, 0}; if (call_video_choose(&caps, &state.peer, &next) <= 0 || !encoder.open(next, 1000000)) { m->report(tr("Selected video mode is unavailable to the peer")); std::lock_guard guard(m->lock); if (m->revision == revision) m->enabled = false;