]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix possible issue with double read of frames in conf
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 5 Sep 2013 19:05:00 +0000 (00:05 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 5 Sep 2013 19:05:00 +0000 (00:05 +0500)
src/mod/applications/mod_conference/mod_conference.c
src/switch_core_io.c
src/switch_core_media.c

index 0ad4c1bc67b10a9ce3fce32368fe91d691db8121..6007fb2047477200b26534f8c72289640881352a 100644 (file)
@@ -1459,6 +1459,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
                if (switch_channel_test_flag(channel, CF_VIDEO)) {
                        if (switch_test_flag(conference, CFLAG_VIDEO_BRIDGE)) {
                                switch_channel_set_flag(channel, CF_VIDEO_ECHO);
+                               switch_channel_clear_flag(channel, CF_VIDEO_PASSIVE);
                        } else {
                                switch_channel_clear_flag(channel, CF_VIDEO_ECHO);
                        }
@@ -1618,7 +1619,7 @@ static void conference_set_video_floor_holder(conference_obj_t *conference, conf
        if (member) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Adding video floor %s\n", 
                                                  switch_channel_get_name(member->channel));
-               switch_channel_set_flag(member->channel, CF_VIDEO_PASSIVE);
+               //switch_channel_set_flag(member->channel, CF_VIDEO_PASSIVE);
                switch_core_session_refresh_video(member->session);
                conference->video_floor_holder = member;
        } else {
@@ -1627,7 +1628,7 @@ static void conference_set_video_floor_holder(conference_obj_t *conference, conf
 
        if (old_member) {
                old_id = old_member->id;
-               switch_channel_clear_flag(old_member->channel, CF_VIDEO_PASSIVE);
+               //switch_channel_clear_flag(old_member->channel, CF_VIDEO_PASSIVE);
        }
 
        switch_set_flag(conference, CFLAG_FLOOR_CHANGE);
@@ -7488,6 +7489,7 @@ SWITCH_STANDARD_APP(conference_function)
        switch_core_session_video_reset(session);
 
        switch_channel_set_flag(channel, CF_CONFERENCE);
+       switch_channel_set_flag(channel, CF_VIDEO_PASSIVE);
 
        if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel answer failed.\n");
@@ -8042,6 +8044,7 @@ SWITCH_STANDARD_APP(conference_function)
  end:
 
        switch_channel_clear_flag(channel, CF_CONFERENCE);
+       switch_channel_clear_flag(channel, CF_VIDEO_PASSIVE);
 
        switch_core_session_video_reset(session);
 }
index 5f8386505e7610d53bc4eb16ed8a99a156250b5b..3eb9852e20690cb8a49e7711fc271308dfe123e8 100644 (file)
@@ -229,6 +229,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                        }
                }
 
+               if (status == SWITCH_STATUS_INUSE) {
+                       *frame = &runtime.dummy_cng_frame;
+                       switch_yield(20000);
+                       return SWITCH_STATUS_SUCCESS;
+               }
+
                if (!SWITCH_READ_ACCEPTABLE(status) || !session->read_codec || !switch_core_codec_ready(session->read_codec)) {
                        *frame = NULL;
                        return SWITCH_STATUS_FALSE;
index 2d18266cb5f216f2514432c8d0d168388e7a8439..eccb0774ff3b475048a9e15c3026f06d3b761205 100644 (file)
@@ -1231,14 +1231,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
 
        if (switch_mutex_trylock(engine->read_mutex) != SWITCH_STATUS_SUCCESS) {
                /* 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;
+               return SWITCH_STATUS_INUSE;
        }