mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
a whole bunch of stuff just to avoid a sonus issue silence_when_idle=400 chanvar to send generated silence duing sleeps etc
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10664 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -158,6 +158,7 @@ struct switch_rtp {
|
||||
uint32_t last_write_ts;
|
||||
uint32_t last_write_samplecount;
|
||||
uint32_t next_write_samplecount;
|
||||
switch_time_t last_write_timestamp;
|
||||
uint32_t flags;
|
||||
switch_memory_pool_t *pool;
|
||||
switch_sockaddr_t *from_addr;
|
||||
@@ -1885,15 +1886,27 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
|
||||
|
||||
rtp_session->send_msg.header.ts = htonl(rtp_session->ts);
|
||||
|
||||
|
||||
if ((rtp_session->ts > (rtp_session->last_write_ts + (rtp_session->samples_per_interval * 10)))
|
||||
|| rtp_session->ts == rtp_session->samples_per_interval) {
|
||||
m++;
|
||||
}
|
||||
|
||||
if (rtp_session->timer.interval &&
|
||||
(rtp_session->timer.samplecount - rtp_session->last_write_samplecount) > rtp_session->samples_per_interval * 2) {
|
||||
m++;
|
||||
}
|
||||
|
||||
if (!rtp_session->timer.interval &&
|
||||
((unsigned)((switch_timestamp_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet *2)) {
|
||||
m++;
|
||||
}
|
||||
|
||||
if (rtp_session->cn && payload != rtp_session->cng_pt) {
|
||||
rtp_session->cn = 0;
|
||||
m++;
|
||||
}
|
||||
|
||||
send_msg->header.m = m ? 1 : 0;
|
||||
|
||||
memcpy(send_msg->body, data, datalen);
|
||||
@@ -2049,7 +2062,10 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
|
||||
|
||||
if (rtp_session->timer.interval) {
|
||||
rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
|
||||
} else {
|
||||
rtp_session->last_write_timestamp = (uint32_t) switch_timestamp_now();
|
||||
}
|
||||
|
||||
rtp_session->last_write_ts = this_ts;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user