]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5802 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 19 Sep 2013 18:14:11 +0000 (13:14 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 19 Sep 2013 18:14:11 +0000 (13:14 -0500)
src/mod/applications/mod_conference/mod_conference.c

index 111e4ef917abbea9eebf29621f93dc1d1bbeb25a..57a7f58b32a5b8651d3abe7c3ae8393488dd2180 100644 (file)
@@ -3185,7 +3185,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
 
 
        if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
-               return NULL;
+               goto end;
        }
 
        switch_assert(member != NULL);
@@ -3482,10 +3482,12 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
 
 
        switch_resample_destroy(&member->read_resampler);
-       switch_clear_flag_locked(member, MFLAG_ITHREAD);
-
        switch_core_session_rwunlock(session);
 
+ end:
+
+       switch_clear_flag_locked(member, MFLAG_ITHREAD);
+
        return NULL;
 }
 
@@ -3583,7 +3585,9 @@ static void launch_conference_loop_input(conference_member_t *member, switch_mem
        switch_threadattr_create(&thd_attr, pool);
        switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
        switch_set_flag_locked(member, MFLAG_ITHREAD);
-       switch_thread_create(&member->input_thread, thd_attr, conference_loop_input, member, pool);
+       if (switch_thread_create(&member->input_thread, thd_attr, conference_loop_input, member, pool) != SWITCH_STATUS_SUCCESS) {
+               switch_clear_flag_locked(member, MFLAG_ITHREAD);
+       }
 }
 
 /* marshall frames from the conference (or file or tts output) to the call leg */
@@ -3919,6 +3923,7 @@ static void conference_loop_output(conference_member_t *member)
 
        switch_clear_flag_locked(member, MFLAG_RUNNING);
 
+       /* Wait for the input thread to end */
        if (member->input_thread) {
                switch_thread_join(&st, member->input_thread);
        }
@@ -3932,11 +3937,6 @@ static void conference_loop_output(conference_member_t *member)
        if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
                member->conference->bridge_hangup_cause = switch_channel_get_cause(channel);
        }
-
-       /* Wait for the input thread to end */
-       while (switch_test_flag(member, MFLAG_ITHREAD)) {
-               switch_cond_next();
-       }
 }
 
 /* Sub-Routine called by a record entity inside a conference */