Wake video transmission on router queue readiness without polling delay

This commit is contained in:
evgeny committed 2026-10-19 17:38:31 +02:00
1 parent 5f1985f9ab
commit 4ed2c4bbab
2 files changed
+32 -3

No files matched your search

+18 -1
View File
@@ -4,12 +4,16 @@
#define etcp_router_tx_stats test_router_tx_stats
#define etcp_router_send_q_has_room test_router_send_q_has_room
#define etcp_router_resume_receive test_router_resume_receive
#define etcp_router_on_send_ready test_router_on_send_ready
#define etcp_router_cancel_send_ready test_router_cancel_send_ready
#include "../src/call/call_video_transport.c"
#undef etcp_router_conn_get
#undef etcp_router_conn_send
#undef etcp_router_tx_stats
#undef etcp_router_send_q_has_room
#undef etcp_router_resume_receive
#undef etcp_router_on_send_ready
#undef etcp_router_cancel_send_ready
#include <assert.h>
#include <stdio.h>
@@ -19,6 +23,8 @@ extern void process_immediate_queue(struct UASYNC *ua);
static struct ETCP_ROUTER_CONN router;
static unsigned packets, received, room, resumed;
static uint64_t debt;
static queue_threshold_callback_fn ready_callback;
static void *ready_arg;
enum { FRAME_BYTES = 45001 };
static uint8_t output[FRAME_BYTES];
@@ -44,6 +50,14 @@ int test_router_send_q_has_room(struct UTUN_INSTANCE *inst, uint64_t group, uint
void test_router_resume_receive(struct UTUN_INSTANCE *inst, uint64_t group, uint64_t peer, uint8_t svc) {
(void)inst; (void)group; (void)peer; (void)svc; resumed++;
}
void test_router_on_send_ready(struct UTUN_INSTANCE *inst, uint64_t group, uint64_t peer, uint8_t svc,
struct queue_waiter_handle *h, queue_threshold_callback_fn callback, void *arg) {
(void)inst; (void)group; (void)peer; (void)svc; (void)h; ready_callback = callback; ready_arg = arg;
}
void test_router_cancel_send_ready(struct UTUN_INSTANCE *inst, uint64_t group, uint64_t peer, uint8_t svc,
struct queue_waiter_handle *h) {
(void)inst; (void)group; (void)peer; (void)svc; (void)h; ready_callback = NULL; ready_arg = NULL;
}
static struct call_video_transport *setup(struct call_session *s) {
struct call_video_transport *v = u_calloc(1, sizeof(*v)); assert(v);
@@ -93,7 +107,10 @@ int main(void) {
if (gate) debt = 1000000; else room = 0;
process_immediate_queue(ua); assert(packets == 16 && !v->flush_pending && v->flush_net_wait == 1);
process_immediate_queue(ua); assert(packets == 16);
room = 1; debt = 0; flush(v); uasync_drain_immediate(ua); check_complete(v); cleanup(&s);
room = 1; debt = 0;
if (!gate) { assert(ready_callback && ready_arg == v); ready_callback(router.send_q, ready_arg); }
else flush(v);
uasync_drain_immediate(ua); check_complete(v); cleanup(&s);
}
puts("PASS: router room and inflight debt stop continuation without spinning; TX resumes exactly once");