<h1>Project "FreeSWITCH Source" received a push.</h1>
<h2>branch: master updated</h2>
<pre>
via: d59d41d7b4d0609ebdbbab1592baa3f45240481e (commit)
from: bc397ab6000d8e8acaeecf351a3281428226d0d9 (commit)
</pre>= COMMIT LOG ===========================================================
<div class="highlight"><pre>committer: Anthony Minessale
comments:
add param to jb to try to recapture latency (disabled by default)
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h</span>
<span style="color: #000080; font-weight: bold">index 2870bba..94c9d67 100644</span>
<span style="color: #A00000">--- a/src/include/switch_rtp.h</span>
<span style="color: #00A000">+++ b/src/include/switch_rtp.h</span>
<span style="color: #800080; font-weight: bold">@@ -232,7 +232,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi</span>
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session,
                                                                                                                                 uint32_t queue_frames,
                                                                                                                                 uint32_t max_queue_frames,
<span style="color: #A00000">-                                                                                                                                 uint32_t samples_per_packet, uint32_t samples_per_second);</span>
<span style="color: #00A000">+                                                                                                                                 uint32_t samples_per_packet, uint32_t samples_per_second, uint32_t max_drift);</span>
SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name);
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #000080; font-weight: bold">index 9e8d820..e8e78e5 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #800080; font-weight: bold">@@ -1349,10 +1349,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi</span>
        case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
                {
                        if (switch_rtp_ready(tech_pvt->rtp_session)) {
<span style="color: #A00000">-                                int len, maxlen = 0, qlen = 0, maxqlen = 50;</span>
<span style="color: #00A000">+                                int len, maxlen = 0, qlen = 0, maxqlen = 50, max_drift = 0;</span>
                                if (msg->string_arg) {
<span style="color: #A00000">-                                        char *p;</span>
<span style="color: #00A000">+                                        char *p, *q;</span>
                                        const char *s;
                                        if (!strcasecmp(msg->string_arg, "pause")) {
<span style="color: #800080; font-weight: bold">@@ -1379,6 +1379,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi</span>
                                                if ((p = strchr(msg->string_arg, ':'))) {
                                                        p++;
                                                        maxlen = atol(p);
<span style="color: #00A000">+                                                        if ((q = strchr(p, ':'))) {</span>
<span style="color: #00A000">+                                                                q++;</span>
<span style="color: #00A000">+                                                                max_drift = abs(atol(q));</span>
<span style="color: #00A000">+                                                        }</span>
                                                }
                                        }
<span style="color: #800080; font-weight: bold">@@ -1391,9 +1395,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi</span>
                                if (qlen) {
                                        if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen,
                                                                                                                 tech_pvt->read_impl.samples_per_packet,
<span style="color: #A00000">-                                                                                                                 tech_pvt->read_impl.samples_per_second) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                                                                                                                 tech_pvt->read_impl.samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {</span>
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
<span style="color: #A00000">-                                                                                 SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n", len, qlen, maxqlen);</span>
<span style="color: #00A000">+                                                                                 SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames) (%d max drift)\n", </span>
<span style="color: #00A000">+                                                                                 len, qlen, maxqlen, max_drift);</span>
                                                switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER);
                                        } else {
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #000080; font-weight: bold">index 01a70f3..66f5e52 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #800080; font-weight: bold">@@ -3166,12 +3166,16 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f</span>
                if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec")) || (val = tech_pvt->profile->jb_msec)) {
                        int jb_msec = atoi(val);
<span style="color: #A00000">-                        int maxlen = 0;</span>
<span style="color: #A00000">-                        char *p;</span>
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                        int maxlen = 0, max_drift = 0;</span>
<span style="color: #00A000">+                        char *p, *q;</span>
<span style="color: #00A000">+                        </span>
                        if ((p = strchr(val, ':'))) {
                                p++;
                                maxlen = atoi(p);
<span style="color: #00A000">+                                if ((q = strchr(p, ':'))) {</span>
<span style="color: #00A000">+                                        q++;</span>
<span style="color: #00A000">+                                        max_drift = abs(atoi(q));</span>
<span style="color: #00A000">+                                }</span>
                        }
                        if (jb_msec < 20 || jb_msec > 10000) {
<span style="color: #800080; font-weight: bold">@@ -3188,7 +3192,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f</span>
                                if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen,
                                                                                                         tech_pvt->read_impl.samples_per_packet,
<span style="color: #A00000">-                                                                                                         tech_pvt->read_impl.samples_per_second) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                                                                                                         tech_pvt->read_impl.samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {</span>
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
                                                                         SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", jb_msec, qlen);
                                        switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER);
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_ivr.c b/src/switch_ivr.c</span>
<span style="color: #000080; font-weight: bold">index a40da1b..5a08276 100644</span>
<span style="color: #A00000">--- a/src/switch_ivr.c</span>
<span style="color: #00A000">+++ b/src/switch_ivr.c</span>
<span style="color: #800080; font-weight: bold">@@ -2289,7 +2289,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3</span>
        qlen = delay_ms / (interval);
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen);
<span style="color: #A00000">-        jb = stfu_n_init(qlen, qlen, read_impl.samples_per_packet, read_impl.samples_per_second);</span>
<span style="color: #00A000">+        jb = stfu_n_init(qlen, qlen, read_impl.samples_per_packet, read_impl.samples_per_second, 0);</span>
        write_frame.codec = switch_core_session_get_read_codec(session);
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_rtp.c b/src/switch_rtp.c</span>
<span style="color: #000080; font-weight: bold">index 029f067..b6b3832 100644</span>
<span style="color: #A00000">--- a/src/switch_rtp.c</span>
<span style="color: #00A000">+++ b/src/switch_rtp.c</span>
<span style="color: #800080; font-weight: bold">@@ -1909,7 +1909,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *</span>
                                                                                                                                 uint32_t queue_frames,
                                                                                                                                 uint32_t max_queue_frames,
                                                                                                                                 uint32_t samples_per_packet,
<span style="color: #A00000">-                                                                                                                                 uint32_t samples_per_second)</span>
<span style="color: #00A000">+                                                                                                                                 uint32_t samples_per_second,</span>
<span style="color: #00A000">+                                                                                                                                 uint32_t max_drift)</span>
{
        if (!switch_rtp_ready(rtp_session)) {
<span style="color: #800080; font-weight: bold">@@ -1920,7 +1921,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *</span>
        if (rtp_session->jb) {
                stfu_n_resize(rtp_session->jb, queue_frames);
        } else {
<span style="color: #A00000">-                rtp_session->jb = stfu_n_init(queue_frames, max_queue_frames ? max_queue_frames : 50, samples_per_packet, samples_per_second);</span>
<span style="color: #00A000">+                rtp_session->jb = stfu_n_init(queue_frames, max_queue_frames ? max_queue_frames : 50, samples_per_packet, samples_per_second, max_drift);</span>
        }
        READ_DEC(rtp_session);
        
<span style="color: #800080; font-weight: bold">@@ -2402,7 +2403,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t</span>
        uint32_t ts;
        switch_assert(bytes);
<span style="color: #A00000">-</span>
<span style="color: #00A000">+ more:</span>
        *bytes = sizeof(rtp_msg_t);
        status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, bytes);
        ts = ntohl(rtp_session->recv_msg.header.ts);
<span style="color: #800080; font-weight: bold">@@ -2489,9 +2490,13 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t</span>
                        stfu_n_reset(rtp_session->jb);
                }
<span style="color: #A00000">-                stfu_n_eat(rtp_session->jb, rtp_session->last_read_ts, </span>
<span style="color: #A00000">-                                 rtp_session->recv_msg.header.pt,</span>
<span style="color: #A00000">-                                 rtp_session->recv_msg.body, *bytes - rtp_header_len, rtp_session->timer.samplecount);</span>
<span style="color: #00A000">+                if (stfu_n_eat(rtp_session->jb, rtp_session->last_read_ts, </span>
<span style="color: #00A000">+                                         rtp_session->recv_msg.header.pt,</span>
<span style="color: #00A000">+                                         rtp_session->recv_msg.body, *bytes - rtp_header_len, rtp_session->timer.samplecount) == STFU_ITS_TOO_LATE) {</span>
<span style="color: #00A000">+                        printf("doh\n");</span>
<span style="color: #00A000">+                        goto more;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
                status = SWITCH_STATUS_FALSE;
                if (!return_jb_packet) {
                        return status;
</pre></div>
========================================================================<pre>
Summary of changes:
src/include/switch_rtp.h | 2 +-
src/mod/endpoints/mod_sofia/mod_sofia.c | 13 +++++++++----
src/mod/endpoints/mod_sofia/sofia_glue.c | 12 ++++++++----
src/switch_ivr.c | 2 +-
src/switch_rtp.c | 17 +++++++++++------
5 files changed, 30 insertions(+), 16 deletions(-)
</pre>
<p>this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email<br />
For more info, see <a href="http://blog.chomperstomp.com/?p=630">http://blog.chomperstomp.com/?p=630</a>
-- <br />
FreeSWITCH Source</p>