update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5093 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
8048656f99
commit
da80e53f02
|
@ -53,7 +53,7 @@
|
||||||
<!-- Request a certain tone/file to be played while you wait for the call to be answered-->
|
<!-- 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=${us-ring}"/>
|
||||||
<!--<action application="set" data="ringback=/home/ring.wav"/>-->
|
<!--<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@conference.freeswitch.org"/>
|
<action application="bridge" data="sofia/$${sip_profile}/1234@conference.freeswitch.org"/>
|
||||||
</condition>
|
</condition>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -90,6 +90,21 @@ stfu_instance_t *stfu_n_init(uint32_t qlen)
|
||||||
return i;
|
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)
|
static int32_t stfu_n_measure_interval(stfu_queue_t *queue)
|
||||||
{
|
{
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
|
@ -148,7 +163,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, void *data, size_
|
||||||
i->out_queue->wr_len = 0;
|
i->out_queue->wr_len = 0;
|
||||||
i->out_queue->last_index = 0;
|
i->out_queue->last_index = 0;
|
||||||
i->miss_count = 0;
|
i->miss_count = 0;
|
||||||
|
|
||||||
if (stfu_n_process(i, i->out_queue) < 0) {
|
if (stfu_n_process(i, i->out_queue) < 0) {
|
||||||
return STFU_IT_FAILED;
|
return STFU_IT_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +198,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
|
||||||
stfu_frame_t *frame = NULL, *rframe = NULL;
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +214,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = &i->out_queue->array[index];
|
frame = &i->out_queue->array[index];
|
||||||
|
|
||||||
if (frame->ts != should_have) {
|
if (frame->ts != should_have) {
|
||||||
int tried = 0;
|
int tried = 0;
|
||||||
for (index2 = 0; index2 < i->out_queue->array_len; index2++) {
|
for (index2 = 0; index2 < i->out_queue->array_len; index2++) {
|
||||||
|
@ -226,12 +241,13 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
|
||||||
|
|
||||||
i->miss_count++;
|
i->miss_count++;
|
||||||
|
|
||||||
if (i->miss_count > 10 || i->in_queue->array_len == i->in_queue->array_size ) {
|
if (i->miss_count > 10 || (i->in_queue->array_len == i->in_queue->array_size) || tried >= i->in_queue->array_size) {
|
||||||
i->out_queue->wr_len = i->out_queue->array_len;
|
i->running = 0;
|
||||||
i->last_ts = should_have = frame->ts;
|
i->interval = 0;
|
||||||
|
i->out_queue->wr_len = i->out_queue->array_size;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
i->last_ts = should_have;
|
i->last_ts = should_have;
|
||||||
rframe = &i->out_queue->int_frame;
|
rframe = &i->out_queue->int_frame;
|
||||||
rframe->dlen = i->out_queue->array[i->out_queue->last_index].dlen;
|
rframe->dlen = i->out_queue->array[i->out_queue->last_index].dlen;
|
||||||
|
|
|
@ -88,7 +88,9 @@ void stfu_n_destroy(stfu_instance_t **i);
|
||||||
stfu_instance_t *stfu_n_init(uint32_t qlen);
|
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_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);
|
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)
|
#define stfu_n_eat(i,t,d,l) stfu_n_add_data(i, t, d, l, 0)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -73,7 +73,7 @@ static inline switch_status_t timer_init(switch_timer_t *timer)
|
||||||
{
|
{
|
||||||
timer_private_t *private_info;
|
timer_private_t *private_info;
|
||||||
|
|
||||||
if (globals.RUNNING != 1) {
|
if (globals.RUNNING != 1 || !globals.mutex) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -816,6 +816,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
||||||
switch_size_t bytes = 0;
|
switch_size_t bytes = 0;
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
uint8_t check = 1;
|
uint8_t check = 1;
|
||||||
|
stfu_frame_t *jb_frame;
|
||||||
|
|
||||||
if (!rtp_session->timer.interval) {
|
if (!rtp_session->timer.interval) {
|
||||||
rtp_session->last_time = switch_time_now();
|
rtp_session->last_time = switch_time_now();
|
||||||
|
@ -833,22 +834,23 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rtp_session->jb && bytes) {
|
if (rtp_session->jb && bytes && rtp_session->recv_msg.header.pt == rtp_session->payload) {
|
||||||
stfu_frame_t *frame;
|
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);
|
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))) {
|
if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
|
||||||
memcpy(rtp_session->recv_msg.body, frame->data, frame->dlen);
|
memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen);
|
||||||
if (frame->plc) {
|
if (jb_frame->plc) {
|
||||||
*flags |= SFF_PLC;
|
*flags |= SFF_PLC;
|
||||||
}
|
}
|
||||||
bytes = frame->dlen + rtp_header_len;
|
bytes = jb_frame->dlen + rtp_header_len;
|
||||||
rtp_session->recv_msg.header.ts = htonl(frame->ts);
|
rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
|
||||||
} else {
|
} else {
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK)) {
|
if (!bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK)) {
|
||||||
|
@ -882,15 +884,22 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
do_2833(rtp_session);
|
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;
|
uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
|
||||||
/* We're late! We're Late! */
|
/* We're late! We're Late! */
|
||||||
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) && status == SWITCH_STATUS_BREAK) {
|
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) && status == SWITCH_STATUS_BREAK) {
|
||||||
switch_yield(1000);
|
switch_yield(1000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(data, 0, 2);
|
memset(data, 0, 2);
|
||||||
data[0] = 65;
|
data[0] = 65;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue