FS-7602 FS-7499 FS-7587 modify dtls init function placement

This commit is contained in:
Anthony Minessale 2015-06-04 20:37:15 -05:00
parent 22335d212d
commit 8aea72c825
4 changed files with 15 additions and 15 deletions

View File

@ -332,7 +332,7 @@ SWITCH_DECLARE(switch_media_flow_t) switch_core_session_media_flow(switch_core_s
SWITCH_DECLARE(switch_status_t) switch_core_media_get_vid_params(switch_core_session_t *session, switch_vid_params_t *vid_params); SWITCH_DECLARE(switch_status_t) switch_core_media_get_vid_params(switch_core_session_t *session, switch_vid_params_t *vid_params);
SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_session_t *session, switch_file_handle_t *fh, switch_rw_t rw); SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_session_t *session, switch_file_handle_t *fh, switch_rw_t rw);
SWITCH_DECLARE(switch_bool_t) switch_core_session_in_video_thread(switch_core_session_t *session); SWITCH_DECLARE(switch_bool_t) switch_core_session_in_video_thread(switch_core_session_t *session);
SWITCH_DECLARE(switch_bool_t) switch_core_media_check_dtls(switch_core_session_t *session); SWITCH_DECLARE(switch_bool_t) switch_core_media_check_dtls(switch_core_session_t *session, switch_media_type_t type);
SWITCH_END_EXTERN_C SWITCH_END_EXTERN_C
#endif #endif

View File

@ -3402,6 +3402,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
const char *uuid; const char *uuid;
switch_core_session_t *other_session; switch_core_session_t *other_session;
switch_core_media_check_dtls(channel->session, SWITCH_MEDIA_TYPE_AUDIO);
switch_channel_check_zrtp(channel); switch_channel_check_zrtp(channel);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name); switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
switch_channel_set_flag(channel, CF_EARLY_MEDIA); switch_channel_set_flag(channel, CF_EARLY_MEDIA);
@ -3673,6 +3675,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
switch_core_media_check_dtls(channel->session, SWITCH_MEDIA_TYPE_AUDIO);
if (channel->caller_profile && channel->caller_profile->times) { if (channel->caller_profile && channel->caller_profile->times) {
switch_mutex_lock(channel->profile_mutex); switch_mutex_lock(channel->profile_mutex);
channel->caller_profile->times->answered = switch_micro_time_now(); channel->caller_profile->times->answered = switch_micro_time_now();

View File

@ -4847,6 +4847,8 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
mh->up = 1; mh->up = 1;
switch_mutex_lock(mh->cond_mutex); switch_mutex_lock(mh->cond_mutex);
switch_core_media_check_dtls(session, SWITCH_MEDIA_TYPE_VIDEO);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread started. Echo is %s\n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread started. Echo is %s\n",
switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off"); switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off");
switch_core_session_request_video_refresh(session); switch_core_session_request_video_refresh(session);
@ -8585,11 +8587,11 @@ static int check_engine(switch_rtp_engine_t *engine)
return 1; return 1;
} }
SWITCH_DECLARE(switch_bool_t) switch_core_media_check_dtls(switch_core_session_t *session) SWITCH_DECLARE(switch_bool_t) switch_core_media_check_dtls(switch_core_session_t *session, switch_media_type_t type)
{ {
switch_media_handle_t *smh; switch_media_handle_t *smh;
switch_rtp_engine_t *a_engine, *v_engine; switch_rtp_engine_t *engine;
int audio_checking = 0, video_checking = 0; int checking = 0;
switch_assert(session); switch_assert(session);
@ -8605,15 +8607,13 @@ SWITCH_DECLARE(switch_bool_t) switch_core_media_check_dtls(switch_core_session_t
return SWITCH_TRUE; return SWITCH_TRUE;
} }
a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; engine = &smh->engines[type];
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
do { do {
if (a_engine->rtp_session) audio_checking = check_engine(a_engine); if (engine->rtp_session) checking = check_engine(engine);
if (v_engine->rtp_session) check_engine(v_engine); } while (switch_channel_ready(session->channel) && checking);
} while (switch_channel_ready(session->channel) && (audio_checking || video_checking));
if (!audio_checking && !video_checking) { if (!checking) {
return SWITCH_TRUE; return SWITCH_TRUE;
} }

View File

@ -487,10 +487,6 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
} }
} }
if (state > CS_INIT && switch_channel_media_up(session->channel)) {
switch_core_media_check_dtls(session);
}
switch (state) { switch (state) {
case CS_NEW: /* Just created, Waiting for first instructions */ case CS_NEW: /* Just created, Waiting for first instructions */
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) State NEW\n", switch_channel_get_name(session->channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) State NEW\n", switch_channel_get_name(session->channel));