mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 12:40:17 +00:00
update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1107 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
e907575bb3
commit
e28a9ee83b
@ -585,7 +585,10 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram
|
||||
now = switch_time_now();
|
||||
tech_pvt->read_frame.flags = 0;
|
||||
tech_pvt->read_frame.datalen = switch_rtp_zerocopy_read(tech_pvt->rtp_session, &tech_pvt->read_frame.data, &payload, &tech_pvt->read_frame.flags);
|
||||
|
||||
|
||||
if (tech_pvt->read_frame.datalen < 0) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (timeout > -1) {
|
||||
elapsed = (unsigned int)((switch_time_now() - started) / 1000);
|
||||
|
@ -465,9 +465,22 @@ static int rtp_common_read(switch_rtp *rtp_session, void *data, int *payload_typ
|
||||
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_SECURE) && bytes > 0) {
|
||||
if (bytes < 0) {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE)) {
|
||||
int sbytes = (int)bytes;
|
||||
srtp_unprotect(rtp_session->recv_ctx, &rtp_session->send_msg, &sbytes);
|
||||
err_status_t stat;
|
||||
|
||||
stat = srtp_unprotect(rtp_session->recv_ctx, &rtp_session->recv_msg, &sbytes);
|
||||
if (stat) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
|
||||
"error: srtp unprotection failed with code %d%s\n", stat,
|
||||
stat == err_status_replay_fail ? " (replay check failed)" :
|
||||
stat == err_status_auth_fail ? " (auth check failed)" : "");
|
||||
return -1;
|
||||
}
|
||||
bytes = sbytes;
|
||||
}
|
||||
|
||||
@ -496,11 +509,6 @@ static int rtp_common_read(switch_rtp *rtp_session, void *data, int *payload_typ
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bytes < 0) {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
if (rtp_session->recv_msg.header.version != 2) {
|
||||
if (rtp_session->recv_msg.header.version == 0 && rtp_session->ice_user) {
|
||||
handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
|
||||
@ -542,11 +550,12 @@ SWITCH_DECLARE(int) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **dat
|
||||
{
|
||||
|
||||
int bytes = rtp_common_read(rtp_session, data, payload_type, flags);
|
||||
*data = NULL;
|
||||
*data = rtp_session->recv_msg.body;
|
||||
|
||||
if (bytes <= 0) {
|
||||
return bytes;
|
||||
}
|
||||
*data = rtp_session->recv_msg.body;
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user