]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core, mod_verto] remove CF_VIDEO_ONLY and pay attention to the streams instead and...
authorAnthony Minessale <anthm@signalwire.com>
Tue, 14 Apr 2020 19:52:38 +0000 (19:52 +0000)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 19:00:28 +0000 (22:00 +0300)
src/include/switch_types.h
src/mod/applications/mod_conference/conference_event.c
src/mod/applications/mod_conference/conference_member.c
src/mod/applications/mod_conference/mod_conference.c
src/mod/endpoints/mod_verto/mod_verto.c
src/switch_core_media.c

index 674de974d0de783cb8e1ccd8a37d7dff6466396b..a1bc0204ec4e37df9a018500e57af166d63c78bf 100644 (file)
@@ -1595,7 +1595,7 @@ typedef enum {
        CF_VIDEO_DECODED_READ,
        CF_VIDEO_DEBUG_READ,
        CF_VIDEO_DEBUG_WRITE,
-       CF_VIDEO_ONLY,
+       CF_NO_RECOVER,
        CF_VIDEO_READY,
        CF_VIDEO_MIRROR_INPUT,
        CF_VIDEO_READ_FILE_ATTACHED,
index 806dfc95ed24058c347a3fc6f77392fc5da8e571..23adb127a8c90e7c3a7cb2bbab90dab664b4222b 100644 (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_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;
                const char *uuid = switch_core_session_get_uuid(member->session);
                const char *cookie = switch_channel_get_variable(member->channel, "event_channel_cookie");
index 74264b0677db17f4039a11ca3f17172ee304b20f..f9c036baec8b253afafacc55fcb3e0f8a5b910e4 100644 (file)
@@ -186,7 +186,7 @@ void conference_member_update_status_field(conference_member_t *member)
                                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))) {
                                cJSON_AddItemToObject(video, "screenShare", cJSON_CreateTrue());
                        }
index 670d6ac9de28f058f3c2042228aa9e0f0938aa18..875d0f97316e2db1c507fbc59ce2a80a890fc122 100644 (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_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)) {
-               while(conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) {
-                       switch_frame_t *read_frame;
-                       if (switch_channel_test_flag(channel, CF_AUDIO)) {
-                               switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+       /* Run the conference loop */
+       do {
+               switch_media_flow_t audio_flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO);
+               
+               if (switch_channel_test_flag(channel, CF_AUDIO) && (audio_flow == SWITCH_MEDIA_FLOW_SENDRECV || audio_flow == SWITCH_MEDIA_FLOW_RECVONLY)) {
+                       conference_loop_output(&member);
+               } else {
+                       if (conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) {
+                               switch_yield(100000);
+                               member.loop_loop = 1;
+                       } else {
+                               break;
                        }
-                       switch_yield(100000);
                }
-       } else {
-
-               /* Run the conference loop */
-               do {
-                       conference_loop_output(&member);
-               } while (member.loop_loop);
-       }
+       } while (member.loop_loop);
 
        switch_core_session_video_reset(session);
        switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ);
index 3a94f112c8e0902df04dab41e7e01a0f3623297f..b5dcce22691ad32d93efaf60c4121c0db6e22fd5 100644 (file)
@@ -1347,7 +1347,7 @@ static void detach_calls(jsock_t *jsock)
                                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);
                                continue;
                        }
@@ -2762,7 +2762,7 @@ static int verto_recover_callback(switch_core_session_t *session)
        const char *profile_name = NULL, *jsock_uuid_str = NULL;
        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;
        }
 
@@ -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)
 {
-       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_channel_t *channel;
        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;
        }
 
-       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_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) {
index b6cb4b6670878fb3d2c86d0201a7876f075076ed..bfaff772894a1b9349e9eb86519967590043fe1a 100644 (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) {
-               return SWITCH_STATUS_SUCCESS;
+       if (type == SWITCH_MEDIA_TYPE_AUDIO) {
+               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) {