FS-10019 revert and alternate fix

This commit is contained in:
Anthony Minessale 2017-02-16 18:26:26 -06:00
parent c9aa35227a
commit 23c9605efb
4 changed files with 14 additions and 37 deletions

View File

@ -423,7 +423,7 @@ switch_status_t conference_close_open_files(conference_obj_t *conference)
{
int x = 0;
switch_mutex_lock(conference->mutex);
switch_mutex_lock(conference->file_mutex);
/* Close Unused Handles */
if (conference->fnode) {
conference_file_node_t *fnode, *cur;
@ -453,7 +453,7 @@ switch_status_t conference_close_open_files(conference_obj_t *conference)
switch_core_destroy_memory_pool(&pool);
x++;
}
switch_mutex_unlock(conference->mutex);
switch_mutex_unlock(conference->file_mutex);
return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
}

View File

@ -2465,7 +2465,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
video_count = 0;
switch_mutex_lock(conference->mutex);
switch_mutex_lock(conference->file_mutex);
if (conference->async_fnode && switch_core_file_has_video(&conference->async_fnode->fh, SWITCH_TRUE)) {
check_async_file = 1;
file_count++;
@ -2479,7 +2479,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
video_count++;
files_playing = 1;
}
switch_mutex_unlock(conference->mutex);
switch_mutex_unlock(conference->file_mutex);
switch_mutex_lock(conference->member_mutex);
for (imember = conference->members; imember; imember = imember->next) {
@ -2912,7 +2912,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
layout_applied = 0;
}
switch_mutex_lock(conference->mutex);
switch_mutex_lock(conference->file_mutex);
if (check_async_file && conference->async_fnode) {
switch_status_t st = switch_core_file_read_video(&conference->async_fnode->fh, &file_frame, SVR_FLUSH);
@ -2939,7 +2939,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
j++;
}
}
switch_mutex_unlock(conference->mutex);
switch_mutex_unlock(conference->file_mutex);
for (imember = conference->members; imember; imember = imember->next) {
int i = 0;

View File

@ -699,16 +699,19 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
conference_video_canvas_del_fnode_layer(conference, conference->async_fnode);
}
switch_mutex_lock(conference->file_mutex);
conference_file_close(conference, conference->async_fnode);
pool = conference->async_fnode->pool;
conference->async_fnode = NULL;
switch_core_destroy_memory_pool(&pool);
switch_mutex_unlock(conference->file_mutex);
}
if (conference->fnode && conference->fnode->done) {
conference_file_node_t *fnode;
switch_memory_pool_t *pool;
switch_mutex_lock(conference->file_mutex);
if (conference->fnode->type != NODE_TYPE_SPEECH) {
conference_file_close(conference, conference->fnode);
}
@ -717,6 +720,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
conference_video_canvas_del_fnode_layer(conference, conference->fnode);
}
fnode = conference->fnode;
conference->fnode = conference->fnode->next;
@ -728,6 +732,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
pool = fnode->pool;
fnode = NULL;
switch_core_destroy_memory_pool(&pool);
switch_mutex_unlock(conference->file_mutex);
}
if (!conference->end_count && conference->endconference_time &&
@ -821,37 +826,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
}
}
switch_mutex_lock(conference->mutex);
/* Close Unused Handles */
if (conference->fnode) {
conference_file_node_t *fnode, *cur;
switch_memory_pool_t *pool;
fnode = conference->fnode;
while (fnode) {
cur = fnode;
fnode = fnode->next;
if (cur->type != NODE_TYPE_SPEECH) {
conference_file_close(conference, cur);
}
pool = cur->pool;
switch_core_destroy_memory_pool(&pool);
}
conference->fnode = NULL;
}
if (conference->async_fnode) {
switch_memory_pool_t *pool;
conference_file_close(conference, conference->async_fnode);
pool = conference->async_fnode->pool;
conference->async_fnode = NULL;
switch_core_destroy_memory_pool(&pool);
}
switch_mutex_unlock(conference->mutex);
conference_close_open_files(conference);
/* Wait till everybody is out */
conference_utils_clear_flag_locked(conference, CFLAG_RUNNING);
@ -3457,6 +3432,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
/* Activate the conference mutex for exclusivity */
switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
switch_mutex_init(&conference->file_mutex, SWITCH_MUTEX_NESTED, conference->pool);
switch_thread_rwlock_create(&conference->rwlock, conference->pool);
switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
switch_mutex_init(&conference->canvas_mutex, SWITCH_MUTEX_NESTED, conference->pool);

View File

@ -603,6 +603,7 @@ typedef struct conference_obj {
member_flag_t mflags[MFLAG_MAX];
switch_call_cause_t bridge_hangup_cause;
switch_mutex_t *flag_mutex;
switch_mutex_t *file_mutex;
uint32_t rate;
uint32_t interval;
uint32_t channels;