FS-11417: [mod_conference] Unbounded memory growth during screen share #resolve

This commit is contained in:
Anthony Minessale 2018-09-28 08:41:29 +04:00 committed by Andrey Volk
parent 27669eda04
commit d4a0040c88
2 changed files with 18 additions and 11 deletions

View 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)) ||

View File

@ -606,7 +606,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;
}
@ -666,15 +667,16 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
write_frame[x] = (int16_t) z;
}
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 */
int16_t write_frame[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
@ -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;
}