From faaef0fbe346b5e28ee1029c83f5d100476db259 Mon Sep 17 00:00:00 2001 From: Mark Spencer <markster@digium.com> Date: Sat, 1 May 2004 15:18:28 +0000 Subject: [PATCH] Add DTX support (mark bit) (bug #1234) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2842 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- rtp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rtp.c b/rtp.c index cc7383101b..14a2f9825f 100755 --- a/rtp.c +++ b/rtp.c @@ -366,9 +366,9 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp) return &null_frame; } -static void calc_rxstamp(struct timeval *tv, struct ast_rtp *rtp, unsigned int timestamp) +static void calc_rxstamp(struct timeval *tv, struct ast_rtp *rtp, unsigned int timestamp, int mark) { - if (!rtp->rxcore.tv_sec && !rtp->rxcore.tv_usec) { + if ((!rtp->rxcore.tv_sec && !rtp->rxcore.tv_usec) || mark) { gettimeofday(&rtp->rxcore, NULL); rtp->rxcore.tv_sec -= timestamp / 8000; rtp->rxcore.tv_usec -= (timestamp % 8000) * 125; @@ -530,7 +530,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp) ast_log(LOG_NOTICE, "Unable to calculate samples for format %s\n", ast_getformatname(rtp->f.subclass)); break; } - calc_rxstamp(&rtp->f.delivery, rtp, timestamp); + calc_rxstamp(&rtp->f.delivery, rtp, timestamp, mark); } else { /* Video -- samples is # of samples vs. 90000 */ if (!rtp->lastividtimestamp) @@ -1026,8 +1026,10 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec and if so, go with our prediction */ if (abs(rtp->lastts - pred) < 640) rtp->lastts = pred; - else + else { ast_log(LOG_DEBUG, "Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms); + mark = 1; + } } } else { mark = f->subclass & 0x1; -- GitLab