FSCORE-523

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16207 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2010-01-08 00:45:09 +00:00
parent c2acaa0e6f
commit e26f141bf8
4 changed files with 15 additions and 9 deletions

View File

@ -178,7 +178,7 @@ static int16_t stfu_n_process(stfu_instance_t *i, stfu_queue_t *queue)
return 0; return 0;
} }
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, uint32_t pt, void *data, size_t datalen, int last)
{ {
uint32_t index; uint32_t index;
stfu_frame_t *frame; stfu_frame_t *frame;
@ -203,10 +203,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, void *data, size_
if (stfu_n_process(i, i->out_queue) < 0) { if (stfu_n_process(i, i->out_queue) < 0) {
if (i->in_queue->array_len == i->in_queue->array_size && i->out_queue->array_len == i->out_queue->array_size) { if (i->in_queue->array_len == i->in_queue->array_size && i->out_queue->array_len == i->out_queue->array_size) {
stfu_n_resize(i, i->out_queue->array_size * 2); stfu_n_resize(i, i->out_queue->array_size * 2);
printf("DOH RESIZE\n");
} }
//return STFU_IT_FAILED; //return STFU_IT_FAILED;
} }
for(index = 0; index < i->out_queue->array_len; index++) { for(index = 0; index < i->out_queue->array_len; index++) {
@ -226,6 +223,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, void *data, size_
} }
memcpy(frame->data, data, cplen); memcpy(frame->data, data, cplen);
frame->pt = pt;
frame->ts = ts; frame->ts = ts;
frame->dlen = cplen; frame->dlen = cplen;
frame->was_read = 0; frame->was_read = 0;

View File

@ -74,6 +74,7 @@ typedef enum {
struct stfu_frame { struct stfu_frame {
uint32_t ts; uint32_t ts;
uint32_t pt;
uint8_t data[STFU_DATALEN]; uint8_t data[STFU_DATALEN];
size_t dlen; size_t dlen;
uint8_t was_read; uint8_t was_read;
@ -97,12 +98,12 @@ void stfu_n_report(stfu_instance_t *i, stfu_report_t *r);
void stfu_n_destroy(stfu_instance_t **i); 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_resize(stfu_instance_t *i, uint32_t qlen); 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, void *data, size_t datalen, int last); stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, 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);
void stfu_n_reset(stfu_instance_t *i); void stfu_n_reset(stfu_instance_t *i);
#define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 1) #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,p,d,l) stfu_n_add_data(i, t, p, d, l, 0)
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -2046,7 +2046,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3
break; break;
} }
stfu_n_eat(jb, ts, read_frame->data, read_frame->datalen); stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen);
ts += interval; ts += interval;
if ((jb_frame = stfu_n_read_a_frame(jb))) { if ((jb_frame = stfu_n_read_a_frame(jb))) {

View File

@ -1763,12 +1763,18 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
rtp_session->stats.inbound.packet_count++; rtp_session->stats.inbound.packet_count++;
} }
if (rtp_session->te && rtp_session->recv_msg.header.pt == rtp_session->te) {
return SWITCH_STATUS_SUCCESS;
}
if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) { if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) {
if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->te) { if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->te) {
stfu_n_reset(rtp_session->jb); 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.header.pt,
rtp_session->recv_msg.body, *bytes - rtp_header_len);
*bytes = 0; *bytes = 0;
status = SWITCH_STATUS_FALSE; status = SWITCH_STATUS_FALSE;
} }
@ -1783,7 +1789,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
} }
*bytes = jb_frame->dlen + rtp_header_len; *bytes = jb_frame->dlen + rtp_header_len;
rtp_session->recv_msg.header.ts = htonl(jb_frame->ts); rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
rtp_session->recv_msg.header.pt = rtp_session->payload; rtp_session->recv_msg.header.pt = jb_frame->pt;
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
} }
} }