Adapt call transport tests and desktop setup to profile negotiation

This commit is contained in:
evgeny committed 2026-10-14 23:09:51 +02:00
1 parent 3063270a67
commit 68e5905d9e
2 files changed
+8 -7

No files matched your search

+4 -4
View File
@@ -148,7 +148,7 @@ static struct call_video_frame video_test_frame(uint64_t id, unsigned generation
struct call_video_frame f = {0}; struct call_video_frame f = {0};
f.call_id = id; f.frame_id = generation; f.pts_us = sent_timing.pts_us + generation * 30000; 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, 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; f.flags = CALL_VIDEO_KEY; f.size = f.length = sizeof(g_video_data); f.data = g_video_data;
return f; 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; for (unsigned i = 4; i < sizeof(g_video_data); i++) g_video_data[i] = (uint8_t)i;
struct call_video_caps caps = {0}; struct call_video_caps caps = {0};
caps.encode[0] = caps.encode[1] = caps.decode[0] = caps.decode[1] 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; caps.encode[1].level = caps.decode[1].level = 93;
if (call_video_configure(A, t->call_id, &caps, &video_ops, (void*)0) 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; } || 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; 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); 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; } 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 if (call_video_send_frame(A, &invalid) != -1
|| call_video_configure_rate(A, t->call_id, &invalid.format, 800000, 400000) != -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); int result = call_video_send_frame(A, &f);
if (result < 0) { fprintf(stderr, "video send failed\n"); t->result = 2; break; } if (result < 0) { fprintf(stderr, "video send failed\n"); t->result = 2; break; }
+4 -3
View File
@@ -133,10 +133,11 @@ void CallVideoEngine::transmit() {
call_video_caps caps{}; call_video_caps caps{};
// Каждый объявленный codec проверяется реальным encoder + независимым decoder при open. // Каждый объявленный codec проверяется реальным encoder + независимым decoder при open.
for (unsigned codec = 1; codec <= 2 && m->running; ++codec) { 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; CallVideoEncoder encoder;
if (encoder.open(probe, 1000000)) { 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; 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())); } 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 (!enabled || !state.have_peer || pts <= lastPts || (lastPts >= 0 && pts - lastPts < 33333)) { idle(); continue; }
if (revision != appliedRevision) { if (revision != appliedRevision) {
if (lastKey >= 0 && pts - lastKey < 1000000) { idle(); continue; } 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)) { if (call_video_choose(&caps, &state.peer, &next) <= 0 || !encoder.open(next, 1000000)) {
m->report(tr("Selected video mode is unavailable to the peer")); m->report(tr("Selected video mode is unavailable to the peer"));
std::lock_guard<std::mutex> guard(m->lock); if (m->revision == revision) m->enabled = false; std::lock_guard<std::mutex> guard(m->lock); if (m->revision == revision) m->enabled = false;