fix media reload on verto and sip re-invites

This commit is contained in:
Anthony Minessale 2015-01-21 21:08:09 -06:00
parent 062ddcfa6f
commit 90d3cb633c
2 changed files with 18 additions and 9 deletions

View File

@ -3916,7 +3916,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
const char *rm_encoding;
const switch_codec_implementation_t *mimp = NULL;
int vmatch = 0, i;
nm_idx = 0;
m_idx = 0;
memset(matches, 0, sizeof(matches[0]) * MAX_MATCHES);
@ -3991,7 +3991,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
if (!(rm_encoding = map->rm_encoding)) {
rm_encoding = "";
}
for (i = 0; i < total_codecs; i++) {
const switch_codec_implementation_t *imp = codec_array[i];
@ -4078,7 +4078,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
pmap->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
pmap->agreed_pt = (switch_payload_t) map->rm_pt;
smh->negotiated_codecs[smh->num_negotiated_codecs++] = mimp;
#if 0
if (j == 0 && (!switch_true(mirror) && switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND)) {
@ -5812,6 +5813,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
video_up:
if (session && v_engine) {
printf("WTFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF?????\n");
check_dtls_reinvite(session, v_engine);
}

View File

@ -379,6 +379,7 @@ struct switch_rtp {
switch_mutex_t *flag_mutex;
switch_mutex_t *read_mutex;
switch_mutex_t *write_mutex;
switch_mutex_t *ice_mutex;
switch_timer_t timer;
uint8_t ready;
uint8_t cn;
@ -842,6 +843,8 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
return;
}
switch_mutex_lock(rtp_session->ice_mutex);
READ_INC(rtp_session);
WRITE_INC(rtp_session);
@ -1213,7 +1216,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
end:
switch_mutex_unlock(rtp_session->ice_mutex);
READ_DEC(rtp_session);
WRITE_DEC(rtp_session);
}
@ -3499,6 +3502,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
switch_mutex_init(&rtp_session->flag_mutex, SWITCH_MUTEX_NESTED, pool);
switch_mutex_init(&rtp_session->read_mutex, SWITCH_MUTEX_NESTED, pool);
switch_mutex_init(&rtp_session->write_mutex, SWITCH_MUTEX_NESTED, pool);
switch_mutex_init(&rtp_session->ice_mutex, SWITCH_MUTEX_NESTED, pool);
switch_mutex_init(&rtp_session->dtmf_data.dtmf_mutex, SWITCH_MUTEX_NESTED, pool);
switch_queue_create(&rtp_session->dtmf_data.dtmf_queue, 100, rtp_session->pool);
switch_queue_create(&rtp_session->dtmf_data.dtmf_inqueue, 100, rtp_session->pool);
@ -3947,7 +3951,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
switch_port_t port = 0;
char bufc[30];
READ_INC(rtp_session);
switch_mutex_lock(rtp_session->ice_mutex);
if (proto == IPR_RTP) {
ice = &rtp_session->ice;
@ -4016,7 +4020,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
switch_rtp_break(rtp_session);
}
READ_DEC(rtp_session);
switch_mutex_unlock(rtp_session->ice_mutex);
return SWITCH_STATUS_SUCCESS;
}
@ -6630,11 +6634,13 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]);
rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL;
if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp], &rtp_session->send_policy[rtp_session->srtp_idx_rtp]))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR,
"Error! RE-Activating %s Secure RTP SEND\n", rtp_type(rtp_session));
ret = -1;
goto end;
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, "RE-Activating Secure RTP SEND\n");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO,
"RE-Activating %s Secure RTP SEND\n", rtp_type(rtp_session));
}
}
@ -6642,7 +6648,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
stat = srtp_protect(rtp_session->send_ctx[rtp_session->srtp_idx_rtp], &send_msg->header, &sbytes);
if (stat) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error: SRTP protection failed with code %d\n", stat);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR,
"Error: %s SRTP protection failed with code %d\n", rtp_type(rtp_session), stat);
}
bytes = sbytes;