[core, mod_verto] remove CF_VIDEO_ONLY and pay attention to the streams instead and add CF_NO_RECOVER flag for verto

This commit is contained in:
Anthony Minessale 2020-04-14 19:52:38 +00:00 committed by Andrey Volk
parent 55922ac6d0
commit 9457bf9082
6 changed files with 35 additions and 24 deletions

View File

@ -1595,7 +1595,7 @@ typedef enum {
CF_VIDEO_DECODED_READ, CF_VIDEO_DECODED_READ,
CF_VIDEO_DEBUG_READ, CF_VIDEO_DEBUG_READ,
CF_VIDEO_DEBUG_WRITE, CF_VIDEO_DEBUG_WRITE,
CF_VIDEO_ONLY, CF_NO_RECOVER,
CF_VIDEO_READY, CF_VIDEO_READY,
CF_VIDEO_MIRROR_INPUT, CF_VIDEO_MIRROR_INPUT,
CF_VIDEO_READ_FILE_ATTACHED, CF_VIDEO_READ_FILE_ATTACHED,

View File

@ -634,7 +634,7 @@ void conference_event_adv_la(conference_obj_t *conference, conference_member_t *
switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ); switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ);
switch_core_media_gen_key_frame(member->session); switch_core_media_gen_key_frame(member->session);
if (conference && conference->la && member->session && !switch_channel_test_flag(member->channel, CF_VIDEO_ONLY)) { if (conference && conference->la && member->session) {
cJSON *msg, *data; cJSON *msg, *data;
const char *uuid = switch_core_session_get_uuid(member->session); const char *uuid = switch_core_session_get_uuid(member->session);
const char *cookie = switch_channel_get_variable(member->channel, "event_channel_cookie"); const char *cookie = switch_channel_get_variable(member->channel, "event_channel_cookie");

View File

@ -186,7 +186,7 @@ void conference_member_update_status_field(conference_member_t *member)
cJSON_AddItemToObject(video, "visible", cJSON_CreateFalse()); cJSON_AddItemToObject(video, "visible", cJSON_CreateFalse());
} }
cJSON_AddItemToObject(video, "videoOnly", cJSON_CreateBool(switch_channel_test_flag(member->channel, CF_VIDEO_ONLY))); cJSON_AddItemToObject(video, "noRecover", cJSON_CreateBool(switch_channel_test_flag(member->channel, CF_NO_RECOVER)));
if (switch_true(switch_channel_get_variable_dup(member->channel, "video_screen_share", SWITCH_FALSE, -1))) { if (switch_true(switch_channel_get_variable_dup(member->channel, "video_screen_share", SWITCH_FALSE, -1))) {
cJSON_AddItemToObject(video, "screenShare", cJSON_CreateTrue()); cJSON_AddItemToObject(video, "screenShare", cJSON_CreateTrue());
} }

View File

@ -2474,21 +2474,21 @@ SWITCH_STANDARD_APP(conference_function)
switch_core_session_set_video_read_callback(session, conference_video_thread_callback, (void *)&member); switch_core_session_set_video_read_callback(session, conference_video_thread_callback, (void *)&member);
switch_core_session_set_text_read_callback(session, conference_text_thread_callback, (void *)&member); switch_core_session_set_text_read_callback(session, conference_text_thread_callback, (void *)&member);
if (switch_channel_test_flag(channel, CF_VIDEO_ONLY) || !switch_channel_test_flag(channel, CF_AUDIO)) { /* Run the conference loop */
while(conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) { do {
switch_frame_t *read_frame; switch_media_flow_t audio_flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO);
if (switch_channel_test_flag(channel, CF_AUDIO)) {
switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (switch_channel_test_flag(channel, CF_AUDIO) && (audio_flow == SWITCH_MEDIA_FLOW_SENDRECV || audio_flow == SWITCH_MEDIA_FLOW_RECVONLY)) {
}
switch_yield(100000);
}
} else {
/* Run the conference loop */
do {
conference_loop_output(&member); conference_loop_output(&member);
} while (member.loop_loop); } else {
} if (conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) {
switch_yield(100000);
member.loop_loop = 1;
} else {
break;
}
}
} while (member.loop_loop);
switch_core_session_video_reset(session); switch_core_session_video_reset(session);
switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ); switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ);

View File

@ -1347,7 +1347,7 @@ static void detach_calls(jsock_t *jsock)
continue; continue;
} }
if (switch_channel_test_flag(tech_pvt->channel, CF_VIDEO_ONLY)) { if (switch_channel_test_flag(tech_pvt->channel, CF_NO_RECOVER)) {
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_NORMAL_CLEARING); switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_NORMAL_CLEARING);
continue; continue;
} }
@ -2762,7 +2762,7 @@ static int verto_recover_callback(switch_core_session_t *session)
const char *profile_name = NULL, *jsock_uuid_str = NULL; const char *profile_name = NULL, *jsock_uuid_str = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
if (switch_channel_test_flag(channel, CF_VIDEO_ONLY)) { if (switch_channel_test_flag(channel, CF_NO_RECOVER)) {
return 0; return 0;
} }
@ -3817,7 +3817,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response)
{ {
cJSON *obj = cJSON_CreateObject(), *screenShare = NULL, *dedEnc = NULL, *mirrorInput, *bandwidth = NULL, *canvas = NULL; cJSON *obj = cJSON_CreateObject(), *vobj = NULL, *dedEnc = NULL, *mirrorInput, *bandwidth = NULL, *canvas = NULL;
switch_core_session_t *session = NULL; switch_core_session_t *session = NULL;
switch_channel_t *channel; switch_channel_t *channel;
switch_event_t *var_event; switch_event_t *var_event;
@ -3899,9 +3899,16 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
err = 1; goto cleanup; err = 1; goto cleanup;
} }
if ((screenShare = cJSON_GetObjectItem(dialog, "screenShare")) && screenShare->type == cJSON_True) { if ((vobj = cJSON_GetObjectItem(dialog, "screenShare")) && vobj->type == cJSON_True) {
switch_channel_set_variable(channel, "video_screen_share", "true"); switch_channel_set_variable(channel, "video_screen_share", "true");
switch_channel_set_flag(channel, CF_VIDEO_ONLY); }
if ((vobj = cJSON_GetObjectItem(dialog, "secondSource")) && vobj->type == cJSON_True) {
switch_channel_set_variable(channel, "video_second_source", "true");
}
if ((vobj = cJSON_GetObjectItem(dialog, "recoverCall")) && vobj->type == cJSON_False) {
switch_channel_set_flag(channel, CF_NO_RECOVER);
} }
if ((dedEnc = cJSON_GetObjectItem(dialog, "dedEnc")) && dedEnc->type == cJSON_True) { if ((dedEnc = cJSON_GetObjectItem(dialog, "dedEnc")) && dedEnc->type == cJSON_True) {

View File

@ -3459,8 +3459,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_sessio
} }
} }
if (switch_channel_test_flag(session->channel, CF_VIDEO_ONLY) && type == SWITCH_MEDIA_TYPE_AUDIO) { if (type == SWITCH_MEDIA_TYPE_AUDIO) {
return SWITCH_STATUS_SUCCESS; switch_media_flow_t audio_flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO);
if (audio_flow != SWITCH_MEDIA_FLOW_SENDRECV && audio_flow != SWITCH_MEDIA_FLOW_SENDONLY) {
return SWITCH_STATUS_SUCCESS;
}
} }
if (type != SWITCH_MEDIA_TYPE_TEXT) { if (type != SWITCH_MEDIA_TYPE_TEXT) {