git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1187 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-04-18 16:40:18 +00:00
parent c0891ce9db
commit 912ecb2e43
2 changed files with 15 additions and 15 deletions

View File

@ -667,6 +667,7 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
switch_size_t samples = 0, frames = 0, ms = 0;
switch_channel *channel = NULL;
int payload = 0;
switch_status status;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@ -691,15 +692,12 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
while (!switch_test_flag(tech_pvt, TFLAG_BYE) && switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
payload = -1;
tech_pvt->read_frame.flags = 0;
status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame);
if (switch_rtp_zerocopy_read(tech_pvt->rtp_session,
&tech_pvt->read_frame.data,
&tech_pvt->read_frame.datalen,
&payload,
&tech_pvt->read_frame.flags) != SWITCH_STATUS_SUCCESS) {
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
return SWITCH_STATUS_FALSE;
}
}
payload = tech_pvt->read_frame.payload;
/* RFC2833 ... TBD try harder to honor the duration etc.*/
if (payload == 101) {
@ -857,8 +855,7 @@ static switch_status channel_write_frame(switch_core_session *session, switch_fr
//printf("%s send %d bytes %d samples in %d frames ts=%d\n", switch_channel_get_name(channel), frame->datalen, samples, frames, tech_pvt->timestamp_send);
if (switch_rtp_write(tech_pvt->rtp_session, frame->data, frame->datalen, samples, &frame->flags) < 0) {
if (switch_rtp_write_frame(tech_pvt->rtp_session, frame, samples) < 0) {
return SWITCH_STATUS_FALSE;
}
tech_pvt->timestamp_send += (int) samples;

View File

@ -496,11 +496,7 @@ static int rtp_common_read(switch_rtp *rtp_session, int *payload_type, switch_fr
bytes = sizeof(rtp_msg_t);
status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *)&rtp_session->recv_msg, &bytes);
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && rtp_session->from_addr->port != rtp_session->remote_port) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Auto Changing port to %u\n", rtp_session->from_addr->port);
rtp_session->remote_addr->port = rtp_session->from_addr->port;
}
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
return -1;
}
@ -544,7 +540,14 @@ static int rtp_common_read(switch_rtp *rtp_session, int *payload_type, switch_fr
return 0;
}
if (rtp_session->recv_msg.header.version != 2) {
if (rtp_session->recv_msg.header.version == 2) {
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && rtp_session->from_addr->port &&
(rtp_session->from_addr->port != rtp_session->remote_port)) {
uint32_t old = rtp_session->remote_port;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Auto Changing port from %u to %u\n", old, rtp_session->from_addr->port);
rtp_session->remote_port = rtp_session->from_addr->port;
}
} else {
if (rtp_session->recv_msg.header.version == 0 && rtp_session->ice_user) {
handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
}