[Freeswitch-svn] [commit] r5093 - in freeswitch/trunk: conf libs/stfu src src/mod/timers/mod_softtimer
Freeswitch SVN
anthm at freeswitch.org
Fri May 4 21:31:54 EDT 2007
Author: anthm
Date: Fri May 4 21:31:54 2007
New Revision: 5093
Modified:
freeswitch/trunk/conf/default_context.xml
freeswitch/trunk/libs/stfu/stfu.c
freeswitch/trunk/libs/stfu/stfu.h
freeswitch/trunk/src/mod/timers/mod_softtimer/mod_softtimer.c
freeswitch/trunk/src/switch_rtp.c
Log:
update
Modified: freeswitch/trunk/conf/default_context.xml
==============================================================================
--- freeswitch/trunk/conf/default_context.xml (original)
+++ freeswitch/trunk/conf/default_context.xml Fri May 4 21:31:54 2007
@@ -53,7 +53,7 @@
<!-- Request a certain tone/file to be played while you wait for the call to be answered-->
<action application="set" data="ringback=${us-ring}"/>
<!--<action application="set" data="ringback=/home/ring.wav"/>-->
- <!--<action application="set" data="jitterbuffer_msec=400"/>-->
+ <!--<action application="set" data="jitterbuffer_msec=180"/>-->
<action application="bridge" data="sofia/$${sip_profile}/1234 at conference.freeswitch.org"/>
</condition>
</extension>
Modified: freeswitch/trunk/libs/stfu/stfu.c
==============================================================================
--- freeswitch/trunk/libs/stfu/stfu.c (original)
+++ freeswitch/trunk/libs/stfu/stfu.c Fri May 4 21:31:54 2007
@@ -90,6 +90,21 @@
return i;
}
+void stfu_n_reset(stfu_instance_t *i)
+{
+ i->in_queue = &i->a_queue;
+ i->out_queue = &i->b_queue;
+ i->in_queue->array_len = 0;
+ i->out_queue->array_len = 0;
+ i->out_queue->wr_len = 0;
+ i->out_queue->last_index = 0;
+ i->miss_count = 0;
+ i->last_ts = 0;
+ i->running = 0;
+ i->miss_count = 0;
+ i->interval = 0;
+}
+
static int32_t stfu_n_measure_interval(stfu_queue_t *queue)
{
uint32_t index;
@@ -148,7 +163,7 @@
i->out_queue->wr_len = 0;
i->out_queue->last_index = 0;
i->miss_count = 0;
-
+
if (stfu_n_process(i, i->out_queue) < 0) {
return STFU_IT_FAILED;
}
@@ -183,7 +198,7 @@
stfu_frame_t *frame = NULL, *rframe = NULL;
- if ((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len) {
+ if (((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) {
return NULL;
}
@@ -199,7 +214,7 @@
}
frame = &i->out_queue->array[index];
-
+
if (frame->ts != should_have) {
int tried = 0;
for (index2 = 0; index2 < i->out_queue->array_len; index2++) {
@@ -226,12 +241,13 @@
i->miss_count++;
- if (i->miss_count > 10 || i->in_queue->array_len == i->in_queue->array_size ) {
- i->out_queue->wr_len = i->out_queue->array_len;
- i->last_ts = should_have = frame->ts;
+ if (i->miss_count > 10 || (i->in_queue->array_len == i->in_queue->array_size) || tried >= i->in_queue->array_size) {
+ i->running = 0;
+ i->interval = 0;
+ i->out_queue->wr_len = i->out_queue->array_size;
return NULL;
}
-
+
i->last_ts = should_have;
rframe = &i->out_queue->int_frame;
rframe->dlen = i->out_queue->array[i->out_queue->last_index].dlen;
Modified: freeswitch/trunk/libs/stfu/stfu.h
==============================================================================
--- freeswitch/trunk/libs/stfu/stfu.h (original)
+++ freeswitch/trunk/libs/stfu/stfu.h Fri May 4 21:31:54 2007
@@ -88,7 +88,9 @@
stfu_instance_t *stfu_n_init(uint32_t qlen);
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, void *data, size_t datalen, int last);
stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i);
-#define stfu_im_done() stfu_n_add_data(i, 0, NULL, 0, 1)
+void stfu_n_reset(stfu_instance_t *i);
+
+#define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 1)
#define stfu_n_eat(i,t,d,l) stfu_n_add_data(i, t, d, l, 0)
#ifdef __cplusplus
Modified: freeswitch/trunk/src/mod/timers/mod_softtimer/mod_softtimer.c
==============================================================================
--- freeswitch/trunk/src/mod/timers/mod_softtimer/mod_softtimer.c (original)
+++ freeswitch/trunk/src/mod/timers/mod_softtimer/mod_softtimer.c Fri May 4 21:31:54 2007
@@ -73,7 +73,7 @@
{
timer_private_t *private_info;
- if (globals.RUNNING != 1) {
+ if (globals.RUNNING != 1 || !globals.mutex) {
return SWITCH_STATUS_FALSE;
}
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Fri May 4 21:31:54 2007
@@ -816,6 +816,7 @@
switch_size_t bytes = 0;
switch_status_t status;
uint8_t check = 1;
+ stfu_frame_t *jb_frame;
if (!rtp_session->timer.interval) {
rtp_session->last_time = switch_time_now();
@@ -833,22 +834,23 @@
return -1;
}
- if (rtp_session->jb && bytes) {
- stfu_frame_t *frame;
+ if (rtp_session->jb && bytes && rtp_session->recv_msg.header.pt == rtp_session->payload) {
+ if (rtp_session->recv_msg.header.m) {
+ stfu_n_reset(rtp_session->jb);
+ }
stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.body, bytes - rtp_header_len);
- if ((frame = stfu_n_read_a_frame(rtp_session->jb))) {
- memcpy(rtp_session->recv_msg.body, frame->data, frame->dlen);
- if (frame->plc) {
+ if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
+ memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen);
+ if (jb_frame->plc) {
*flags |= SFF_PLC;
- }
- bytes = frame->dlen + rtp_header_len;
- rtp_session->recv_msg.header.ts = htonl(frame->ts);
+ }
+ bytes = jb_frame->dlen + rtp_header_len;
+ rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
} else {
bytes = 0;
continue;
- }
-
+ }
}
if (!bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK)) {
@@ -882,15 +884,22 @@
if (check) {
do_2833(rtp_session);
-
- if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
+
+ if (rtp_session->jb && (jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
+ memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen);
+ if (jb_frame->plc) {
+ *flags |= SFF_PLC;
+ }
+ bytes = jb_frame->dlen + rtp_header_len;
+ rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
+ } else if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
/* We're late! We're Late! */
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) && status == SWITCH_STATUS_BREAK) {
switch_yield(1000);
continue;
}
-
+
memset(data, 0, 2);
data[0] = 65;
More information about the Freeswitch-svn
mailing list