Browse Source

Verify live bitrate range changes and incompatible codec limits

master
evgeny 5 days ago
parent
commit
cc341221d4
  1. 24
      tests/test_call.c

24
tests/test_call.c

@ -12,6 +12,7 @@
#include "chat_core.h"
#include "chat_sync.h"
#include "chat_event.h"
#include "chat_setting.h"
#include "member_sync.h"
#include "../call/call.h"
#include "../dm/dm_core.h"
@ -61,7 +62,7 @@ enum call_phase {
P_WAIT_ACCEPTED, /* обе ACTIVE */
P_SEND_MEDIA, /* A: call_send_media (тестовый Opus-кадр) */
P_WAIT_MEDIA, /* B: media_recv_cb получил кадр */
P_VIDEO_CONFIG, P_VIDEO_SEND, P_VIDEO_HOLD, P_VIDEO_BUSY, P_VIDEO_RESUME, P_VIDEO_SWITCH, P_VIDEO_SWITCH_WAIT,
P_VIDEO_CONFIG, P_VIDEO_SEND, P_VIDEO_HOLD, P_VIDEO_BUSY, P_VIDEO_RESUME, P_VIDEO_RANGE_WAIT, P_VIDEO_SWITCH, P_VIDEO_SWITCH_WAIT,
P_HANGUP, /* A: call_hangup */
P_WAIT_ENDED1, /* обе ENDED */
P_CALL2_START, /* A: call_start (2-й звонок) */
@ -497,6 +498,11 @@ static void call_tick(void* arg) {
}
break;
case P_VIDEO_CONFIG: {
if (strcmp(chat_setting_get(A, "call_video_bitrate_range_kbps"), "300:4000")
|| chat_setting_set(A, "call_video_bitrate_range_kbps", "4000:300") != -2
|| strcmp(chat_setting_get(A, "call_video_bitrate_range_kbps"), "300:4000")) {
DEBUG_ERROR(DEBUG_CATEGORY_CALL, "video range default/atomic validation failed"); t->result = 2; break;
}
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};
@ -528,15 +534,27 @@ static void call_tick(void* arg) {
case P_VIDEO_RESUME:
if (!g_video_frames || !g_rate_commands) break;
if (g_video_error) { t->result = 2; break; }
// Настройка меняется при незавершённой команде; старый ACK остаётся действительным.
if (chat_setting_set(A, "call_video_bitrate_range_kbps", "300:350")) { t->result = 2; break; }
if (g_rate_commands != 1 || g_rate_generation != 1 || g_rate_bps != 400000
|| call_video_rate_applied(A, t->call_id, 2, g_rate_request, g_rate_bps) != -1
|| call_video_rate_applied(A, t->call_id, 1, g_rate_request + 1, g_rate_bps) != -1
|| call_video_rate_applied(A, t->call_id, 1, g_rate_request, g_rate_bps)) {
fprintf(stderr, "video rate command/completion mismatch\n"); t->result = 2; break;
}
t->phase = P_VIDEO_RANGE_WAIT; break;
case P_VIDEO_RANGE_WAIT:
if (g_rate_commands < 2) break;
if (g_rate_commands != 2 || g_rate_generation != 1 || g_rate_bps != 350000
|| call_video_rate_applied(A, t->call_id, 1, g_rate_request, g_rate_bps)) {
DEBUG_ERROR(DEBUG_CATEGORY_CALL, "video live range change did not converge to 350kbps"); t->result = 2; break;
}
if (chat_setting_set(A, "call_video_bitrate_range_kbps", "500:1000")
|| call_video_configure_rate(A, t->call_id, 2, 350000, 400000) != -1
|| chat_setting_set(A, "call_video_bitrate_range_kbps", "300:350")) { t->result = 2; break; }
t->phase = P_VIDEO_SWITCH; break;
case P_VIDEO_SWITCH: {
if (call_video_configure_rate(A, t->call_id, 2, 400000, 400000)
if (call_video_configure_rate(A, t->call_id, 2, 350000, 400000)
|| call_video_rate_applied(A, t->call_id, 1, g_rate_request, g_rate_bps) != -1) { t->result = 2; break; }
struct call_video_frame f = video_test_frame(t->call_id, 2);
if (call_video_send_frame(A, &f) != 1) { t->result = 2; break; }
@ -551,7 +569,7 @@ static void call_tick(void* arg) {
// Завершение во время незавершённой сборки/паузы приёма не оставляет callbacks.
g_video_ready = 0;
{
if (call_video_configure_rate(A, t->call_id, 3, 400000, 400000)) { t->result = 2; break; }
if (call_video_configure_rate(A, t->call_id, 3, 350000, 400000)) { t->result = 2; break; }
struct call_video_frame f = video_test_frame(t->call_id, 3);
if (call_video_send_frame(A, &f) != 1) { t->result = 2; break; }
}

Loading…
Cancel
Save