<h1>Project "FreeSWITCH Source" received a push.</h1>
<h2>branch: master updated</h2>
<pre>
via: a126cc7f16479578d76cf6395ff92697d021274c (commit)
from: 4ef6280a05cea21e52a4be29fb31d33aa50a19a7 (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/libs/stfu/stfu.c b/libs/stfu/stfu.c</span>
<span style="color: #000080; font-weight: bold">index d2c443a..f00dfaf 100644</span>
<span style="color: #A00000">--- a/libs/stfu/stfu.c</span>
<span style="color: #00A000">+++ b/libs/stfu/stfu.c</span>
<span style="color: #800080; font-weight: bold">@@ -102,7 +102,10 @@ struct stfu_instance {</span>
int32_t ts_offset;
int32_t ts_drift;
<span style="color: #A00000">- </span>
<span style="color: #00A000">+ int32_t max_drift;</span>
<span style="color: #00A000">+ uint32_t drift_dropped_packets;</span>
<span style="color: #00A000">+ uint32_t drift_max_dropped;</span>
<span style="color: #00A000">+</span>
int32_t ts_diff;
int32_t last_ts_diff;
int32_t same_ts;
<span style="color: #800080; font-weight: bold">@@ -258,7 +261,7 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen)</span>
return s;
}
<span style="color: #A00000">-stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second)</span>
<span style="color: #00A000">+stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second, uint32_t max_drift_ms)</span>
{
        struct stfu_instance *i;
<span style="color: #800080; font-weight: bold">@@ -277,6 +280,12 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_</span>
        stfu_n_init_aqueue(&i->b_queue, qlen);
        stfu_n_init_aqueue(&i->c_queue, qlen);
<span style="color: #00A000">+ i->max_drift = (int32_t)(max_drift_ms * (samples_per_second / 1000) * -1);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ if (max_drift_ms && samples_per_packet) {</span>
<span style="color: #00A000">+ i->drift_max_dropped = (samples_per_second * 2) / samples_per_packet;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
        i->in_queue = &i->a_queue;
        i->out_queue = &i->b_queue;
        i->old_queue = &i->c_queue;
<span style="color: #800080; font-weight: bold">@@ -396,6 +405,9 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void</span>
if (i->last_ts_diff == i->ts_diff) {
if (++i->same_ts == 5) {
i->samples_per_packet = i->ts_diff;
<span style="color: #00A000">+ if (i->max_drift && i->samples_per_packet) {</span>
<span style="color: #00A000">+ i->drift_max_dropped = (i->samples_per_second * 2) / i->samples_per_packet;</span>
<span style="color: #00A000">+ }</span>
}
} else {
i->same_ts = 0;
<span style="color: #800080; font-weight: bold">@@ -409,11 +421,24 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void</span>
}
}
<span style="color: #A00000">- if (timer_ts && ts && !i->ts_offset) {</span>
<span style="color: #A00000">- i->ts_offset = timer_ts - ts;</span>
<span style="color: #A00000">- }</span>
<span style="color: #00A000">+ if (timer_ts) {</span>
<span style="color: #00A000">+ if (ts && !i->ts_offset) {</span>
<span style="color: #00A000">+ i->ts_offset = timer_ts - ts;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ i->ts_drift = ts + (i->ts_offset - timer_ts);</span>
<span style="color: #A00000">- i->ts_drift = ts + (i->ts_offset - timer_ts);</span>
<span style="color: #00A000">+ if (i->max_drift) {</span>
<span style="color: #00A000">+ if (i->ts_drift < i->max_drift) {</span>
<span style="color: #00A000">+ if (++i->drift_dropped_packets < i->drift_max_dropped) {</span>
<span style="color: #00A000">+ stfu_log(STFU_LOG_EMERG, "%s TOO LATE !!! %u \n\n\n", i->name, ts);</span>
<span style="color: #00A000">+ return STFU_ITS_TOO_LATE;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+ } else {</span>
<span style="color: #00A000">+ i->drift_dropped_packets = 0;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+ }</span>
if (i->sync_in) {
good_ts = 1;
<span style="color: #800080; font-weight: bold">@@ -493,12 +518,12 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void</span>
if (stfu_log != null_logger && i->debug) {
<span style="color: #A00000">- stfu_log(STFU_LOG_EMERG, "I: %s %u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d %d\n", i->name,</span>
<span style="color: #00A000">+ stfu_log(STFU_LOG_EMERG, "I: %s %u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d %d/%d\n", i->name,</span>
i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count,
i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count,
ts, ts / i->samples_per_packet,
i->period_missing_count, i->period_need_range_avg,
<span style="color: #A00000">- i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count), i->ts_drift);</span>
<span style="color: #00A000">+ i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count), i->ts_drift, i->max_drift);</span>
}
        if (last || i->in_queue->array_len == i->in_queue->array_size) {
<span style="color: #800080; font-weight: bold">@@ -597,7 +622,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)</span>
if (!i->ready) {
if (stfu_log != null_logger && i->debug) {
<span style="color: #A00000">- stfu_log(STFU_LOG_EMERG, "%s XXXSKIP\n", i->name);</span>
<span style="color: #00A000">+ stfu_log(STFU_LOG_EMERG, "%s JITTERBUFFER NOT READY: IGNORING FRAME\n", i->name);</span>
}
return NULL;
}
<span style="color: #800080; font-weight: bold">@@ -612,7 +637,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)</span>
}
if (i->cur_ts == 0) {
if (stfu_log != null_logger && i->debug) {
<span style="color: #A00000">- stfu_log(STFU_LOG_EMERG, "%s XXXPUNT\n", i->name);</span>
<span style="color: #00A000">+ stfu_log(STFU_LOG_EMERG, "%s JITTERBUFFER ERROR: PUNTING\n", i->name);</span>
return NULL;
}
}
<span style="color: #000080; font-weight: bold">diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h</span>
<span style="color: #000080; font-weight: bold">index b92bb3f..d8fbf44 100644</span>
<span style="color: #A00000">--- a/libs/stfu/stfu.h</span>
<span style="color: #00A000">+++ b/libs/stfu/stfu.h</span>
<span style="color: #800080; font-weight: bold">@@ -179,7 +179,7 @@ typedef void (*stfu_n_call_me_t)(stfu_instance_t *i, void *);</span>
void stfu_n_report(stfu_instance_t *i, stfu_report_t *r);
void stfu_n_destroy(stfu_instance_t **i);
<span style="color: #A00000">-stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second);</span>
<span style="color: #00A000">+stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second, uint32_t max_drift_ms);</span>
stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen);
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last);
stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i);
</pre></div>
========================================================================<pre>
Summary of changes:
libs/stfu/stfu.c | 45 +++++++++++++++++++++++++++++++++++----------
libs/stfu/stfu.h | 2 +-
2 files changed, 36 insertions(+), 11 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>