]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11417: [mod_conference] Unbounded memory growth during screen share #resolve
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 28 Sep 2018 04:41:29 +0000 (08:41 +0400)
committerAndrey Volk <andywolk@gmail.com>
Thu, 25 Jul 2019 20:17:41 +0000 (00:17 +0400)
src/mod/applications/mod_conference/conference_loop.c
src/mod/applications/mod_conference/mod_conference.c

index 9c569e5941f1aa96d41712adb2077a9274509a92..362a2129db0b1f89213ba20122f5d4ee11d19e64 100644 (file)
@@ -939,6 +939,10 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
                        goto do_continue;
                }
 
+               if (!switch_channel_test_flag(channel, CF_AUDIO)) {
+                       goto do_continue;
+               }
+               
                /* if the member can speak, compute the audio energy level and */
                /* generate events when the level crosses the threshold        */
                if (((conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK) && !conference_utils_member_test_flag(member, MFLAG_HOLD)) ||
@@ -1228,7 +1232,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
 
                        if (datalen) {
                                switch_size_t ok = 1;
-
+                               
                                /* Write the audio into the input buffer */
                                switch_mutex_lock(member->audio_in_mutex);
                                if (switch_buffer_inuse(member->audio_buffer) > flush_len) {
index 80057b319ddc4bf45a472e048e32c13edd352942..a2b50586560c5f8a0bc65de7ab042e6c800916ee 100644 (file)
@@ -606,10 +606,11 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                        for (omember = conference->members; omember; omember = omember->next) {
                                switch_size_t ok = 1;
 
-                               if (!conference_utils_member_test_flag(omember, MFLAG_RUNNING)) {
+                               if (!conference_utils_member_test_flag(omember, MFLAG_RUNNING) ||
+                                       (!conference_utils_member_test_flag(omember, MFLAG_NOCHANNEL) && !switch_channel_test_flag(omember->channel, CF_AUDIO))) {
                                        continue;
                                }
-
+                               
                                if (!conference_utils_member_test_flag(omember, MFLAG_CAN_HEAR)) {
                                        switch_mutex_lock(omember->audio_out_mutex);
                                        memset(write_frame, 255, bytes);
@@ -666,13 +667,14 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                                        write_frame[x] = (int16_t) z;
                                }
 
-                               switch_mutex_lock(omember->audio_out_mutex);
-                               ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes);
-                               switch_mutex_unlock(omember->audio_out_mutex);
-
-                               if (!ok) {
-                                       switch_mutex_unlock(conference->mutex);
-                                       goto end;
+                               if (!omember->channel || switch_channel_test_flag(omember->channel, CF_AUDIO)) {
+                                       switch_mutex_lock(omember->audio_out_mutex);
+                                       ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes);
+                                       switch_mutex_unlock(omember->audio_out_mutex);
+                                       if (!ok) {
+                                               switch_mutex_unlock(conference->mutex);
+                                               goto end;
+                                       }
                                }
                        }
                } else { /* There is no source audio.  Push silence into all of the buffers */
@@ -687,7 +689,8 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                        for (omember = conference->members; omember; omember = omember->next) {
                                switch_size_t ok = 1;
 
-                               if (!conference_utils_member_test_flag(omember, MFLAG_RUNNING)) {
+                               if (!conference_utils_member_test_flag(omember, MFLAG_RUNNING) ||
+                                       (!conference_utils_member_test_flag(omember, MFLAG_NOCHANNEL) && !switch_channel_test_flag(omember->channel, CF_AUDIO))) {
                                        continue;
                                }