From: Viktor Litvinov Date: Tue, 1 Oct 2024 23:57:12 +0000 (+0200) Subject: res_rtp_asterisk.c: Set Mark on rtp when timestamp skew is too big X-Git-Tag: 21.7.0-rc1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8771180e02037ee45500e055bfa2f0022c087c4c;p=thirdparty%2Fasterisk.git res_rtp_asterisk.c: Set Mark on rtp when timestamp skew is too big Set Mark bit in rtp stream when timestamp skew is bigger than MAX_TIMESTAMP_SKEW. Fixes: #927 (cherry picked from commit 607de362307714338ab11a48a2d62e30497ca410) --- diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 1953e15e29..60e931c71b 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -5267,6 +5267,11 @@ static int rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame *fr } if (ast_test_flag(frame, AST_FRFLAG_HAS_TIMING_INFO)) { + if (abs(frame->ts * rate - (int)rtp->lastts) > MAX_TIMESTAMP_SKEW) { + ast_verbose("(%p) RTP audio difference is %d set mark\n", + instance, abs(frame->ts * rate - (int)rtp->lastts)); + mark = 1; + } rtp->lastts = frame->ts * rate; }