]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix packet storm of vid refresh in edge case
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 24 Jan 2012 17:38:41 +0000 (11:38 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 24 Jan 2012 17:38:41 +0000 (11:38 -0600)
src/mod/applications/mod_conference/mod_conference.c
src/mod/endpoints/mod_sofia/sofia.c

index c88abf2f6b524d56566e140c1a4436df3557c506..4eda6315575bda503e5e1d1a36c86eb9ad8a3213 100644 (file)
@@ -1230,7 +1230,6 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
        int yield = 0;
        uint32_t last_member = 0;
        switch_core_session_t *session;
-       switch_channel_t *channel;
        switch_core_session_message_t msg = { 0 };
 
        conference->video_running = 1;
@@ -1258,7 +1257,6 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
                        goto do_continue;
                }
 
-               channel = NULL;
                session = conference->floor_holder->session;
                switch_core_session_read_lock(session);
                switch_mutex_unlock(conference->member_mutex);
@@ -1271,8 +1269,6 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
                        goto do_continue;
                }
 
-               channel = switch_core_session_get_channel(session);
-               
                if (conference->floor_holder->id != last_member) {
                        int iframe = 0;
 
@@ -1315,17 +1311,10 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
 
                        if (imember->session && switch_channel_test_flag(ichannel, CF_VIDEO)) {
                                has_vid++;
-                               if (switch_channel_test_flag(channel, CF_VIDEO_REFRESH_REQ)) {
-                                       switch_core_session_receive_message(imember->session, &msg);
-                               }
                                switch_core_session_write_video_frame(imember->session, vid_frame, SWITCH_IO_FLAG_NONE, 0);
                        }
                }
                
-               if (switch_channel_test_flag(channel, CF_VIDEO_REFRESH_REQ)) {
-                       switch_channel_clear_flag(channel, CF_VIDEO_REFRESH_REQ);
-               }
-
                if (want_refresh) {
                        switch_core_session_receive_message(session, &msg);
                        want_refresh = 0;
index 822c6b85b6f3cefd392c90939be6977d334fafe2..00d291f8db15d59de21adc36a2fbf429ab92de7b 100644 (file)
@@ -7137,11 +7137,13 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
                        if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "media_control+xml")) {
                                switch_core_session_t *other_session;
                                
-                               switch_channel_set_flag(channel, CF_VIDEO_REFRESH_REQ);
-
-                               if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
-                                       sofia_glue_build_vid_refresh_message(other_session, sip->sip_payload->pl_data);
-                                       switch_core_session_rwunlock(other_session);
+                               if (switch_channel_test_flag(channel, CF_VIDEO)) {
+                                       if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
+                                               sofia_glue_build_vid_refresh_message(other_session, sip->sip_payload->pl_data);
+                                               switch_core_session_rwunlock(other_session);
+                                       } else {
+                                               switch_channel_set_flag(channel, CF_VIDEO_REFRESH_REQ);
+                                       }
                                }
 
                        } else if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf-relay")) {