From db680303eeeae8f0b6cad6360a50a194574cf961 Mon Sep 17 00:00:00 2001 From: evgeny Date: Fri, 30 Oct 2026 21:47:55 +0100 Subject: [PATCH] Share the diagnostic cadence and clamp concurrent pull timestamp skew --- src/call/call_audio.c | 4 ++-- src/call/call_audio_history.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/call/call_audio.c b/src/call/call_audio.c index 9c9a4636c..e6f32f722 100644 --- a/src/call/call_audio.c +++ b/src/call/call_audio.c @@ -136,7 +136,7 @@ static void call_audio_record_tx(uint64_t call_id, const struct call_history_tx* pthread_mutex_lock(&g_mtx); if (g_active && g_call_id == call_id && g_vj) { call_jitter_record_tx(g_vj, snapshot); - if (snapshot->at_ms - g_buffer_log_ms >= 200) { + if (snapshot->at_ms - g_buffer_log_ms >= CALL_BUFFER_LOG_MS) { elapsed = snapshot->at_ms - g_buffer_log_ms; g_buffer_log_ms = snapshot->at_ms; call_jitter_take_log(g_vj, &interval, &tx); /* Сбрасывать и при выключенном debug, чтобы не копить старый интервал. */ report = debug_should_output(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_CALL); @@ -158,7 +158,7 @@ static void call_audio_record_tx(uint64_t call_id, const struct call_history_tx* (unsigned long long)call_id, (unsigned long long)tx.at_ms, (unsigned long long)elapsed, d.encoded_ms + d.processing_ms, d.encoded_ms, d.processing_ms, d.reserve_ms, interval.low_ms, interval.high_ms, (unsigned long long)interval.pulls, interval.samples / 48.0, interval.missing_samples / 48.0, - interval.last_pull_ms ? (long long)(tx.at_ms - interval.last_pull_ms) : -1ll, + interval.last_pull_ms ? (long long)(tx.at_ms > interval.last_pull_ms ? tx.at_ms - interval.last_pull_ms : 0) : -1ll, d.tempo_ppm, d.waiting, d.catching_up, d.underruns, (long long)d.arrival_spread_ms, d.decode_errors, d.budget_hits, (unsigned long long)tx.queued_bytes, (unsigned long long)tx.inflight_bytes, (unsigned long long)tx.transport_bytes, (unsigned long long)tx.peer_id, (unsigned long long)tx.tx_epoch, tx.wire_bytes_per_sec, diff --git a/src/call/call_audio_history.h b/src/call/call_audio_history.h index 7ed7aa84c..c22cb30af 100644 --- a/src/call/call_audio_history.h +++ b/src/call/call_audio_history.h @@ -8,6 +8,7 @@ #define CALL_AUDIO_HISTORY_H #include #define CALL_HISTORY_MS 30000 +#define CALL_BUFFER_LOG_MS 200 /* Общий период сводок uasync; фактический dt выводится при задержке таймера. */ #define CALL_HISTORY_STEP_MS 50 #define CALL_HISTORY_POINTS (CALL_HISTORY_MS / CALL_HISTORY_STEP_MS + 1) #define CALL_HISTORY_BIN_MS 50