if (member == NULL)
return SWITCH_STATUS_GENERR;
- if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) {
return SWITCH_STATUS_SUCCESS;
}
if (member == NULL)
return SWITCH_STATUS_GENERR;
- if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) {
return SWITCH_STATUS_SUCCESS;
}
if (member == NULL)
return SWITCH_STATUS_GENERR;
- if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) {
return SWITCH_STATUS_SUCCESS;
}
void conference_event_adv_la(conference_obj_t *conference, conference_member_t *member, switch_bool_t join)
{
- //if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) {
+ //if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) {
switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ);
switch_core_media_gen_key_frame(member->session);
//}
if (switch_channel_test_flag(member->channel, CF_VIDEO) || member->avatar_png_img) {
video = cJSON_CreateObject();
cJSON_AddItemToObject(video, "avatarPresented", cJSON_CreateBool(!!member->avatar_png_img));
- cJSON_AddItemToObject(video, "mediaFlow", cJSON_CreateString(member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY ? "sendOnly" : "sendRecv"));
+ cJSON_AddItemToObject(video, "mediaFlow", cJSON_CreateString(switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY ? "sendOnly" : "sendRecv"));
cJSON_AddItemToObject(video, "muted", cJSON_CreateBool(!conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN)));
cJSON_AddItemToObject(video, "floor", cJSON_CreateBool(member && member->id == member->conference->video_floor_holder));
if (member && member->id == member->conference->video_floor_holder && conference_utils_test_flag(member->conference, CFLAG_VID_FLOOR_LOCK)) {
switch_mutex_unlock(conference->canvas_mutex);
}
- if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) {
conference_utils_member_clear_flag_locked(member, MFLAG_CAN_BE_SEEN);
}
conference_send_presence(conference);
channel = switch_core_session_get_channel(member->session);
- member->video_flow = switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO);
conference_video_check_avatar(member, SWITCH_FALSE);
return SWITCH_STATUS_FALSE;
}
- if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY && !member->avatar_png_img) {
+ if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY && !member->avatar_png_img) {
return SWITCH_STATUS_FALSE;
}
continue;
}
- if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) {
+ if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) {
continue;
}
canvas = member->conference->canvases[member->canvas_id];
if (conference_utils_test_flag(member->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS) &&
- (!switch_channel_test_flag(member->channel, CF_VIDEO) || member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY)) {
+ (!switch_channel_test_flag(member->channel, CF_VIDEO) || switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY)) {
return;
}
member->avatar_patched = 0;
- if (!force && switch_channel_test_flag(member->channel, CF_VIDEO) && member->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (!force && switch_channel_test_flag(member->channel, CF_VIDEO) && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) {
conference_utils_member_set_flag_locked(member, MFLAG_ACK_VIDEO);
} else {
if (member->conference->no_video_avatar) {
if (!layer &&
(canvas->layers_used < canvas->total_layers ||
(avatar_layers && !member->avatar_png_img) || conference_utils_member_test_flag(member, MFLAG_MOD)) &&
- (member->avatar_png_img || member->video_flow != SWITCH_MEDIA_FLOW_SENDONLY)) {
+ (member->avatar_png_img || switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY)) {
/* find an empty layer */
for (i = 0; i < canvas->total_layers; i++) {
mcu_layer_t *xlayer = &canvas->layers[i];
size = switch_queue_size(member->video_queue);
} while(size > 1);
- if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && member->video_layer_id > -1 && member->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && member->video_layer_id > -1 && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) {
if (img) {
member->good_img++;
if ((member->good_img % (int)(member->conference->video_fps.fps * 10)) == 0) {
switch_img_free(&img);
}
- if (!layer && (!conference_utils_test_flag(imember->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS) || ((switch_channel_test_flag(imember->channel, CF_VIDEO) && imember->video_flow != SWITCH_MEDIA_FLOW_SENDONLY)))) {
+ if (!layer && (!conference_utils_test_flag(imember->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS) || ((switch_channel_test_flag(imember->channel, CF_VIDEO) && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY)))) {
if (conference_video_find_layer(conference, canvas, imember, &layer) == SWITCH_STATUS_SUCCESS) {
imember->layer_timeout = 0;
} else {
total += conference->members_with_avatar;
}
- if (imember->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) {
total--;
}
}
}
- if (imember->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) {
conference_video_pop_next_image(imember, &imember->pcanvas_img);
}
for (imember = conference->members; imember; imember = imember->next) {
int i = 0;
- if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO || imember->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) ||
+ if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO || switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) ||
switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) {
continue;
}
mcu_layer_t *layer = NULL;
switch_image_t *use_img = NULL;
- if (!omember->session || !switch_channel_test_flag(omember->channel, CF_VIDEO) || omember->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (!omember->session || !switch_channel_test_flag(omember->channel, CF_VIDEO) || switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) {
continue;
}
}
if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO) ||
+ switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY ||
switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) {
continue;
}
-
- if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) {
- continue;
- }
-
+
if (need_refresh) {
switch_core_session_request_video_refresh(imember->session);
}
continue;
}
- if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) {
+ if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) {
continue;
}
continue;
}
- if (imember->video_flow == SWITCH_MEDIA_FLOW_SENDONLY && !imember->avatar_png_img) {
+ if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY && !imember->avatar_png_img) {
continue;
}
return;
}
- if (member && member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY && !member->avatar_png_img) {
+ if (member && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY && !member->avatar_png_img) {
return;
}
floor_holder = imember;
}
- if (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_VIDEO) && imember->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) {
+ if (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_VIDEO) && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) {
members_with_video++;
}
char *video_logo;
char *video_mute_png;
char *video_reservation_id;
- switch_media_flow_t video_flow;
switch_frame_buffer_t *fb;
switch_image_t *avatar_png_img;
switch_image_t *video_mute_img;
sofia_clear_flag(tech_pvt, TFLAG_NEW_SDP);
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
+
if (tech_pvt->mparams.num_codecs) {
match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE);
}
switch_core_media_clear_ice(tech_pvt->session);
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
+ switch_channel_set_flag(tech_pvt->channel, CF_RECOVERING);
//switch_channel_audio_sync(tech_pvt->channel);
//switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK);
switch_media_flow_t rmode;
switch_media_flow_t smode;
switch_thread_id_t thread_id;
+ uint8_t new_ice;
+ uint8_t new_dtls;
} switch_rtp_engine_t;
struct switch_media_handle_s {
const char *val;
int ice_seen = 0, cid = 0, ai = 0;
- if (engine->ice_in.is_chosen[0] && engine->ice_in.is_chosen[1] && !switch_channel_test_flag(smh->session->channel, CF_REINVITE)) {
+ if (engine->ice_in.is_chosen[0] && engine->ice_in.is_chosen[1]) {
return SWITCH_STATUS_SUCCESS;
}
+ if (switch_channel_test_flag(smh->session->channel, CF_REINVITE) && !switch_channel_test_flag(smh->session->channel, CF_RECOVERING)) {
+ engine->new_ice = 0;
+ engine->new_dtls = 0;
+ }
+
engine->ice_in.chosen[0] = 0;
engine->ice_in.chosen[1] = 0;
engine->ice_in.is_chosen[0] = 0;
if (switch_channel_test_flag(smh->session->channel, CF_REINVITE)) {
- if (switch_rtp_ready(engine->rtp_session) && engine->ice_in.cands[engine->ice_in.chosen[0]][0].ready) {
+ if (switch_rtp_ready(engine->rtp_session) && engine->ice_in.cands[engine->ice_in.chosen[0]][0].ready && engine->new_ice) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "RE-Activating %s ICE\n", type2str(type));
switch_rtp_activate_ice(engine->rtp_session,
);
-
+ engine->new_ice = 0;
}
switch_channel_clear_flag(smh->session->channel, CF_DTLS);
}
+ a_engine->new_ice = 1;
+ a_engine->new_dtls = 1;
+ v_engine->new_ice = 1;
+ v_engine->new_dtls = 1;
+
+ //if (switch_channel_test_flag(session->channel, CF_REINVITE)) {
+ // switch_core_media_clear_ice(session);
+ //}
+
switch_core_session_parse_crypto_prefs(session);
clear_pmaps(a_engine);
a_engine->rmode = sdp_media_flow(m->m_mode);
-
+
if (sdp_type == SDP_TYPE_REQUEST) {
switch(a_engine->rmode) {
case SWITCH_MEDIA_FLOW_RECVONLY:
static void check_dtls_reinvite(switch_core_session_t *session, switch_rtp_engine_t *engine)
{
- if (switch_channel_test_flag(session->channel, CF_REINVITE)) {
+ if (switch_channel_test_flag(session->channel, CF_REINVITE) && engine->new_dtls) {
if (!zstr(engine->local_dtls_fingerprint.str) && switch_rtp_has_dtls() && dtls_ok(session)) {
dtls_type_t xtype, dtype = switch_ice_direction(session) == SWITCH_CALL_DIRECTION_INBOUND ? DTLS_TYPE_CLIENT : DTLS_TYPE_SERVER;
}
}
+ engine->new_dtls = 0;
}
}
static char *get_setup(switch_core_session_t *session, switch_sdp_type_t sdp_type)
{
- if (sdp_type == SDP_TYPE_RESPONSE && !switch_channel_test_flag(session->channel, CF_RECOVERING)) {
+ if ((sdp_type == SDP_TYPE_RESPONSE || switch_channel_test_flag(session->channel, CF_REINVITE)) &&
+ !switch_channel_test_flag(session->channel, CF_RECOVERING)) {
return "active";
}
switch_status_t status = SWITCH_STATUS_FALSE;
if (switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Writing video to RECVONLY session\n");
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG3, "Writing video to RECVONLY session\n");
return SWITCH_STATUS_SUCCESS;
}
}
if (switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Writing video to RECVONLY session\n");
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG3, "Writing video to RECVONLY session\n");
return SWITCH_STATUS_SUCCESS;
}
end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
switch_stun_packet_first_attribute(packet, attr);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "STUN PACKET TYPE: %s\n",
- switch_stun_value_to_name(SWITCH_STUN_TYPE_PACKET_TYPE, packet->header.type));
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "%s STUN PACKET TYPE: %s\n",
+ rtp_type(rtp_session), switch_stun_value_to_name(SWITCH_STUN_TYPE_PACKET_TYPE, packet->header.type));
do {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|---: STUN ATTR %d %x %s\n", attr->type, attr->type,
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|---: %s STUN ATTR %d %x %s\n", rtp_type(rtp_session), attr->type, attr->type,
switch_stun_value_to_name(SWITCH_STUN_TYPE_ATTRIBUTE, attr->type));
switch (attr->type) {
switch_stun_error_code_t *err = (switch_stun_error_code_t *) attr->value;
uint32_t code = (err->code * 100) + err->number;
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "%s got stun binding response %u %s\n",
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "%s got %s stun binding response %u %s\n",
rtp_session_name(rtp_session),
+ rtp_type(rtp_session),
code,
err->reason
);
if ((ice->type & ICE_VANILLA) && code == 487) {
if ((ice->type & ICE_CONTROLLED)) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "Changing role to CONTROLLING\n");
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "%s STUN Changing role to CONTROLLING\n", rtp_type(rtp_session));
ice->type &= ~ICE_CONTROLLED;
} else {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "Changing role to CONTROLLED\n");
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "%s STUN Changing role to CONTROLLED\n", rtp_type(rtp_session));
ice->type |= ICE_CONTROLLED;
}
packet->header.type = SWITCH_STUN_BINDING_RESPONSE;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO,
- "ICE Auto Changing port from %s:%u to %s:%u\n", old_host, old, host, port);
+ "%s ICE Auto Changing port from %s:%u to %s:%u\n", rtp_type(rtp_session), old_host, old, host, port);
if (channel) {