]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
follow up to last commit
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 16 Aug 2013 16:17:00 +0000 (12:17 -0400)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 16 Aug 2013 16:17:00 +0000 (12:17 -0400)
src/include/switch_core.h
src/mod/applications/mod_conference/mod_conference.c
src/switch_core_media.c
src/switch_core_session.c
src/switch_core_state_machine.c
src/switch_ivr_bridge.c

index dfa1d39d7c08cc589346f8568816654c288e4749..880cf9b893e0706430a7616a9215957196fbf120 100644 (file)
@@ -1015,6 +1015,8 @@ SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(_In_ switch_c
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_session_t *session,
                                                                                                                 _In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg);
+
+SWITCH_DECLARE(void) switch_core_session_video_reset(switch_core_session_t *session);
 /*! 
   \brief Execute an application on a session 
   \param session the current session
index 99b992befdcfd1a3be8dcd9ec51228caa7196dc9..698b2079bdbd3e5e182b5f6874ef827a2bb69783 100644 (file)
@@ -7472,6 +7472,8 @@ SWITCH_STANDARD_APP(conference_function)
                switch_channel_set_app_flag_key("conf_silent", channel, CONF_SILENT_REQ);
        }
 
+       switch_core_session_video_reset(session);
+
        switch_channel_set_flag(channel, CF_CONFERENCE);
 
        if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
@@ -8028,6 +8030,7 @@ SWITCH_STANDARD_APP(conference_function)
 
        switch_channel_clear_flag(channel, CF_CONFERENCE);
 
+       switch_core_session_video_reset(session);
 }
 
 /* Create a thread for the conference and launch it */
index b7c57a5abe856ef175678980a4cd7b915917d4ff..b18ec859e8c9d73efbc6b5fb7a81b5e5b74b4363 100644 (file)
@@ -1225,12 +1225,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
        switch_assert(engine->rtp_session != NULL);
        engine->read_frame.datalen = 0;
 
+       if (!switch_channel_up_nosig(session->channel) || !switch_rtp_ready(engine->rtp_session) || switch_channel_test_flag(session->channel, CF_NOT_READY)) {
+               return SWITCH_STATUS_FALSE;
+       }
+
        if (switch_mutex_trylock(engine->read_mutex) != SWITCH_STATUS_SUCCESS) {
-               /* return CNG for now */
+               /* return CNG, another thread is already reading  */
                *frame = &engine->read_frame;
                switch_set_flag((*frame), SFF_CNG);
                (*frame)->datalen = engine->read_impl.encoded_bytes_per_packet;
                memset((*frame)->data, 0, (*frame)->datalen);
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being read for %s\n", 
+                                                 switch_channel_get_name(session->channel), type2str(type));
+               switch_yield(10000);
                return SWITCH_STATUS_SUCCESS;
        }
 
index 0768feed15dc9af1eba66398dfa8dfa4287b1557..a67359d6770787ab91bb9ccd1a67c2943c91ded5 100644 (file)
@@ -2521,6 +2521,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(sw
        return SWITCH_STATUS_FALSE;
 }
 
+SWITCH_DECLARE(void) switch_core_session_video_reset(switch_core_session_t *session)
+{
+       if (switch_channel_test_flag(session->channel, CF_VIDEO)) {
+               switch_channel_set_flag(session->channel, CF_VIDEO_ECHO);
+               switch_channel_clear_flag(session->channel, CF_VIDEO_PASSIVE);
+               switch_core_session_refresh_video(session);
+       }
+}
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flags(switch_core_session_t *session, const char *app,
                                                                                                                                                                  const char *arg, int32_t *flags)
@@ -2736,19 +2744,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
        msg.string_array_arg[1] = expanded;
        switch_core_session_receive_message(session, &msg);
 
-       if (switch_channel_test_flag(channel, CF_VIDEO)) {
-               switch_channel_set_flag(channel, CF_VIDEO_ECHO);
-               switch_channel_clear_flag(channel, CF_VIDEO_PASSIVE);
-               switch_core_session_refresh_video(session);
-       }
-
        application_interface->application_function(session, expanded);
 
-       if (switch_channel_test_flag(channel, CF_VIDEO)) {
-               switch_channel_set_flag(channel, CF_VIDEO_ECHO);
-               switch_channel_clear_flag(channel, CF_VIDEO_PASSIVE);
-               switch_core_session_refresh_video(session);
-       }
        if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE) == SWITCH_STATUS_SUCCESS) {
                const char *resp = switch_channel_get_variable(session->channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE);
                switch_channel_event_set_data(session->channel, event);
index 56811a1e757affc5ccc2e557a89d126ea3e9180f..5926e52586a08bdd6f2307b5915fe4a1aed5590a 100644 (file)
@@ -216,6 +216,8 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
 
   top:
        switch_channel_clear_flag(session->channel, CF_RESET);
+
+       switch_core_session_video_reset(session);
        
        if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
                switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING);
index f9b22f8a4fc2f1a7d361273b436f10fc5a13dcd7..e0d005aec9cfc505b34427fa06ccd8009b8c0c8b 100644 (file)
@@ -63,7 +63,7 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
 
        if (!switch_stristr("loopback", source) && !switch_stristr("loopback", b_source)) {
                switch_channel_set_flag(channel, CF_VIDEO_PASSIVE);
-               switch_channel_set_flag(b_channel, CF_VIDEO_PASSIVE);
+               //switch_channel_set_flag(b_channel, CF_VIDEO_PASSIVE);
        }
 
        switch_core_session_refresh_video(vh->session_a);
@@ -94,7 +94,7 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
        }
 
        switch_channel_clear_flag(channel, CF_VIDEO_PASSIVE);
-       switch_channel_clear_flag(b_channel, CF_VIDEO_PASSIVE);
+       //switch_channel_clear_flag(b_channel, CF_VIDEO_PASSIVE);
 
        switch_core_session_kill_channel(vh->session_b, SWITCH_SIG_BREAK);
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(vh->session_a), SWITCH_LOG_DEBUG, "%s video thread ended.\n", switch_channel_get_name(channel));
@@ -624,7 +624,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
        if (vid_thread) {
                switch_status_t st;
 
-               if (vh.up) {
+               if (vh.up == 1) {
+                       vh.up = -1;
                        switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK);
                        switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
                }