From 642fc34bcc9a018e85900704d534a949c9da40d2 Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 19 Oct 2026 17:45:17 +0200 Subject: [PATCH] Bound video recovery correction before media timestamp arithmetic --- src/call/call_video_playout.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/call/call_video_playout.c b/src/call/call_video_playout.c index 80345013..549bc4a4 100644 --- a/src/call/call_video_playout.c +++ b/src/call/call_video_playout.c @@ -69,7 +69,8 @@ enum call_video_playout_action call_video_playout_poll(struct call_video_playout // Аудио задаёт базовый темп; долг видео снимается с постоянной 0.5с, максимум 1.6x. int64_t av = f->pts_us - audio; uint32_t base = clock->rate_ppm > 1000000 ? clock->rate_ppm : 1000000; - int64_t speed = base + (av < 0 ? -av * 2 : 0); + int64_t correction = av < -300000 ? 600000 : av < 0 ? -av * 2 : 0; + int64_t speed = base + correction; p->speed_ppm = speed < VIDEO_MAX_SPEED_PPM ? (uint32_t)speed : VIDEO_MAX_SPEED_PPM; int64_t delta = p->last_pts >= 0 ? f->pts_us - p->last_pts : 0; int64_t step = delta / p->speed_ppm * 1000000 + delta % p->speed_ppm * 1000000 / p->speed_ppm;