diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index 7fcf005c30..ac219f4927 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -512,7 +512,7 @@ switch_status_t conference_api_sub_conference_video_vmute_snap(conference_member } if (!member->conference->canvases[0]) { - stream->write_function(stream, "-ERR Conference is not in mixing mode\n"); + if (stream) stream->write_function(stream, "-ERR Conference is not in mixing mode\n"); return SWITCH_STATUS_SUCCESS; } @@ -974,12 +974,12 @@ switch_status_t conference_api_sub_dtmf(conference_member_t *member, switch_stre char *dtmf = (char *) data; if (member == NULL) { - stream->write_function(stream, "-ERR Invalid member!\n"); + if (stream != NULL) stream->write_function(stream, "-ERR Invalid member!\n"); return SWITCH_STATUS_GENERR; } if (zstr(dtmf)) { - stream->write_function(stream, "-ERR Invalid input!\n"); + if (stream != NULL) stream->write_function(stream, "-ERR Invalid input!\n"); return SWITCH_STATUS_GENERR; } else { char *p; @@ -1365,7 +1365,7 @@ switch_status_t conference_api_sub_max_energy(conference_member_t *member, switc if (member->max_energy_level && member->max_energy_level < member->energy_level) { member->max_energy_level = 0; - stream->write_function(stream, "-ERR %u Max-Energy cannot exceed energy level.\n", member->id); + if (stream != NULL) stream->write_function(stream, "-ERR %u Max-Energy cannot exceed energy level.\n", member->id); } else if (data) { char *p, *q; if ((p = strchr(data, ':'))) { @@ -1656,10 +1656,7 @@ switch_status_t conference_api_sub_vid_bandwidth(conference_obj_t *conference, s } if (argv[4]) { - - if (argv[4]) { - id = atoi(argv[4]); - } + id = atoi(argv[4]); if (id < 1 || id > MAX_CANVASES+1) { id = -1; @@ -1685,7 +1682,7 @@ switch_status_t conference_api_sub_vid_bandwidth(conference_obj_t *conference, s } for (i = 0; i <= conference->canvas_count; i++) { - if (i > -1 && i != id - 1) { + if (i != id - 1) { continue; } @@ -1768,15 +1765,14 @@ switch_status_t conference_api_sub_canvas_bgimg(conference_obj_t *conference, sw return SWITCH_STATUS_SUCCESS; } - if ((canvas = conference->canvases[idx])) { - switch_mutex_lock(canvas->mutex); - if (!strcasecmp(file, "clear")) { - conference_video_reset_image(canvas->img, &canvas->bgcolor); - } else { - status = conference_video_set_canvas_bgimg(canvas, file); - } - switch_mutex_unlock(canvas->mutex); + canvas = conference->canvases[idx]; + switch_mutex_lock(canvas->mutex); + if (!strcasecmp(file, "clear")) { + conference_video_reset_image(canvas->img, &canvas->bgcolor); + } else { + status = conference_video_set_canvas_bgimg(canvas, file); } + switch_mutex_unlock(canvas->mutex); if (status == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK Set Bgimg %s\n", file); @@ -1882,7 +1878,7 @@ switch_status_t conference_api_sub_vid_res(conference_obj_t *conference, switch_ } - if (id == 0 && conference->canvases[0]) id = 1; + if (id == 0) id = 1; if (id > conference->canvas_count + 1) { id = 1; @@ -2018,7 +2014,7 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit } } - if (!vlayout && (vlayout = switch_core_hash_find(conference->layout_hash, argv[2]))) { + if ((vlayout = switch_core_hash_find(conference->layout_hash, argv[2]))) { if (argv[3]) { if ((idx = atoi(argv[3]))) { idx--; @@ -2964,7 +2960,6 @@ switch_status_t conference_api_sub_cam(conference_obj_t *conference, switch_stre if (p) { *p++ = '\0'; - if (!p) p = ""; if (!strcasecmp(argv[x], "zoom") || !strcasecmp(argv[x], "pan")) { str_arg = p; @@ -3612,7 +3607,6 @@ switch_status_t conference_api_sub_transfer(conference_obj_t *conference, switch { switch_status_t ret_status = SWITCH_STATUS_SUCCESS; char *conference_name = NULL, *profile_name; - switch_event_t *params = NULL; switch_assert(conference != NULL); switch_assert(stream != NULL); @@ -3621,6 +3615,7 @@ switch_status_t conference_api_sub_transfer(conference_obj_t *conference, switch int x; conference_name = strdup(argv[2]); + switch_assert(conference_name); if ((profile_name = strchr(conference_name, '@'))) { *profile_name++ = '\0'; @@ -3664,10 +3659,6 @@ switch_status_t conference_api_sub_transfer(conference_obj_t *conference, switch ret_status = SWITCH_STATUS_GENERR; } - if (params) { - switch_event_destroy(¶ms); - } - switch_safe_free(conference_name); return ret_status; @@ -4197,6 +4188,7 @@ switch_status_t conference_api_dispatch(conference_obj_t *conference, switch_str char *var, *val; var = strdup(argv[argn + 1]); + switch_assert(var); if ((val = strchr(var, '='))) { *val++ = '\0'; diff --git a/src/mod/applications/mod_conference/conference_cdr.c b/src/mod/applications/mod_conference/conference_cdr.c index 96f9b28a93..ba01a1e6eb 100644 --- a/src/mod/applications/mod_conference/conference_cdr.c +++ b/src/mod/applications/mod_conference/conference_cdr.c @@ -213,7 +213,7 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "status", off3++))) { abort(); } - switch_xml_set_txt_d(x_tag3, np->leave_time ? "disconnected" : "connected"); + switch_xml_set_txt_d(x_tag3, "connected"); if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "joining-info", off3++))) { @@ -398,16 +398,13 @@ cJSON *conference_cdr_json_render(conference_obj_t *conference, cJSON *req) } } - if (np->cp) { - - if (!user_uri) { - user_uri = switch_mprintf("%s@%s", np->cp->caller_id_number, domain); - } - - json_add_child_string(juser, "entity", user_uri); - json_add_child_string(juser, "displayText", np->cp->caller_id_name); + if (!user_uri) { + user_uri = switch_mprintf("%s@%s", np->cp->caller_id_number, domain); } + json_add_child_string(juser, "entity", user_uri); + json_add_child_string(juser, "displayText", np->cp->caller_id_name); + //if (np->record_path) { //json_add_child_string(juser, "recordingPATH", np->record_path); //} @@ -494,11 +491,9 @@ void conference_cdr_del(conference_member_t *member) switch_channel_get_variables(member->channel, &member->cdr_node->var_event); } - if (member->cdr_node) { - member->cdr_node->leave_time = switch_epoch_time_now(NULL); - memcpy(member->cdr_node->mflags, member->flags, sizeof(member->flags)); - member->cdr_node->member = NULL; - } + member->cdr_node->leave_time = switch_epoch_time_now(NULL); + memcpy(member->cdr_node->mflags, member->flags, sizeof(member->flags)); + member->cdr_node->member = NULL; } switch_mutex_unlock(member->conference->member_mutex); } diff --git a/src/mod/applications/mod_conference/conference_event.c b/src/mod/applications/mod_conference/conference_event.c index 083dd35490..94348dca79 100644 --- a/src/mod/applications/mod_conference/conference_event.c +++ b/src/mod/applications/mod_conference/conference_event.c @@ -1019,7 +1019,7 @@ switch_status_t chat_send(switch_event_t *message_event) SWITCH_STANDARD_STREAM(stream); - if (body != NULL && (lbuf = strdup(body))) { + if ((lbuf = strdup(body))) { /* special case list */ if (conference->broadcast_chat_messages) { conference_event_chat_message_broadcast(conference, message_event); diff --git a/src/mod/applications/mod_conference/conference_loop.c b/src/mod/applications/mod_conference/conference_loop.c index 49377312c6..9c569e5941 100644 --- a/src/mod/applications/mod_conference/conference_loop.c +++ b/src/mod/applications/mod_conference/conference_loop.c @@ -1007,12 +1007,12 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob } else if (!member->mute_counter && member->score > (int)((double)member->max_energy_level * .75)) { int dec = 1; - if (member->score_count > 3) { - dec = 2; + if (member->score_count > 9) { + dec = 4; } else if (member->score_count > 6) { dec = 3; - } else if (member->score_count > 9) { - dec = 4; + } else if (member->score_count > 3) { + dec = 2; } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG2, "MAX ENERGY THRESHOLD! -%d\n", dec); @@ -1444,7 +1444,6 @@ void conference_loop_output(conference_member_t *member) while (!member->loop_loop && conference_utils_member_test_flag(member, MFLAG_RUNNING) && conference_utils_member_test_flag(member, MFLAG_ITHREAD) && switch_channel_ready(channel)) { switch_event_t *event; - int use_timer = 0; switch_buffer_t *use_buffer = NULL; uint32_t mux_used = 0; @@ -1503,8 +1502,6 @@ void conference_loop_output(conference_member_t *member) use_buffer = NULL; mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); - use_timer = 1; - if (mux_used) { if (mux_used < bytes) { if (++low_count >= 5) { @@ -1527,28 +1524,26 @@ void conference_loop_output(conference_member_t *member) low_count = 0; if ((write_frame.datalen = (uint32_t) switch_buffer_read(use_buffer, write_frame.data, bytes))) { - if (write_frame.datalen) { - write_frame.samples = write_frame.datalen / 2 / member->conference->channels; + write_frame.samples = write_frame.datalen / 2 / member->conference->channels; - if( !conference_utils_member_test_flag(member, MFLAG_CAN_HEAR)) { - memset(write_frame.data, 255, write_frame.datalen); - } else if (member->volume_out_level) { /* Check for output volume adjustments */ - switch_change_sln_volume(write_frame.data, write_frame.samples * member->conference->channels, member->volume_out_level); - } + if( !conference_utils_member_test_flag(member, MFLAG_CAN_HEAR)) { + memset(write_frame.data, 255, write_frame.datalen); + } else if (member->volume_out_level) { /* Check for output volume adjustments */ + switch_change_sln_volume(write_frame.data, write_frame.samples * member->conference->channels, member->volume_out_level); + } - //write_frame.timestamp = timer.samplecount; + //write_frame.timestamp = timer.samplecount; - if (member->fnode) { - conference_member_add_file_data(member, write_frame.data, write_frame.datalen); - } + if (member->fnode) { + conference_member_add_file_data(member, write_frame.data, write_frame.datalen); + } - conference_member_check_channels(&write_frame, member, SWITCH_FALSE); + conference_member_check_channels(&write_frame, member, SWITCH_FALSE); - if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - switch_mutex_unlock(member->audio_out_mutex); - switch_mutex_unlock(member->write_mutex); - break; - } + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_mutex_unlock(member->audio_out_mutex); + switch_mutex_unlock(member->write_mutex); + break; } } @@ -1641,11 +1636,7 @@ void conference_loop_output(conference_member_t *member) switch_ivr_parse_all_messages(member->session); } - if (use_timer) { - switch_core_timer_next(&timer); - } else { - switch_cond_next(); - } + switch_core_timer_next(&timer); } /* Rinse ... Repeat */ diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index 9f43417fe9..9cdb6f582a 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -128,7 +128,7 @@ void conference_member_update_status_field(conference_member_t *member) char *str, *vstr = "", display[128] = "", *json_display = NULL; cJSON *json, *audio, *video; - if (!member->conference->la || !member->json || !member->status_field || conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) { + if (!member || !member->conference || !member->conference->la || !member->json || !member->status_field || conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) { return; } @@ -157,7 +157,7 @@ void conference_member_update_status_field(conference_member_t *member) vstr = " VIDEO (BLIND)"; } else { vstr = " VIDEO"; - if (member && member->id == member->conference->video_floor_holder) { + if (member->id == member->conference->video_floor_holder) { vstr = " VIDEO (FLOOR)"; } } @@ -194,8 +194,8 @@ void conference_member_update_status_field(conference_member_t *member) cJSON_AddItemToObject(video, "avatarPresented", cJSON_CreateBool(!!member->avatar_png_img)); cJSON_AddItemToObject(video, "mediaFlow", cJSON_CreateString(switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY ? "sendOnly" : "sendRecv")); cJSON_AddItemToObject(video, "muted", cJSON_CreateBool(!conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN))); - cJSON_AddItemToObject(video, "floor", cJSON_CreateBool(member && member->id == member->conference->video_floor_holder)); - if (member && member->id == member->conference->video_floor_holder && conference_utils_test_flag(member->conference, CFLAG_VID_FLOOR_LOCK)) { + cJSON_AddItemToObject(video, "floor", cJSON_CreateBool(member->id == member->conference->video_floor_holder)); + if (member->id == member->conference->video_floor_holder && conference_utils_test_flag(member->conference, CFLAG_VID_FLOOR_LOCK)) { cJSON_AddItemToObject(video, "floorLocked", cJSON_CreateTrue()); } cJSON_AddItemToObject(video, "reservationID", member->video_reservation_id ? @@ -502,7 +502,7 @@ void conference_member_check_channels(switch_frame_t *frame, conference_member_t rlen = frame->datalen / 2 / from; if (in && frame->rate == 48000 && ((from == 1 && to == 2) || (from == 2 && to == 2)) && conference_utils_member_test_flag(member, MFLAG_POSITIONAL)) { - if (from == 2 && to == 2) { + if (from == 2) { switch_mux_channels((int16_t *) frame->data, rlen, 2, 1); frame->datalen /= 2; rlen = frame->datalen / 2; @@ -1397,12 +1397,14 @@ switch_status_t conference_member_play_file(conference_member_t *member, char *f char *dfile = NULL, *expanded = NULL; conference_file_node_t *fnode, *nptr = NULL; switch_memory_pool_t *pool; - int channels = member->conference->channels; + int channels = 0; int bad_params = 0; if (member == NULL || file == NULL || conference_utils_member_test_flag(member, MFLAG_KICKED)) return status; + channels = member->conference->channels; + if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(member->session), file)) != file) { file = expanded; } else { @@ -1510,20 +1512,22 @@ switch_status_t conference_member_play_file(conference_member_t *member, char *f /* Say some thing with TTS in the conference room */ switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin) { - conference_obj_t *conference = member->conference; + conference_obj_t *conference = NULL; conference_file_node_t *fnode, *nptr; switch_memory_pool_t *pool; switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; switch_status_t status = SWITCH_STATUS_FALSE; char *fp = NULL; - int channels = member->conference->channels; + int channels = 0; switch_event_t *params = NULL; const char *position = NULL; if (member == NULL || zstr(text)) return SWITCH_STATUS_FALSE; + conference = member->conference; switch_assert(conference != NULL); + channels = conference->channels; if (!(conference->tts_engine && conference->tts_voice)) { return SWITCH_STATUS_SUCCESS; diff --git a/src/mod/applications/mod_conference/conference_record.c b/src/mod/applications/mod_conference/conference_record.c index d4ccf81c5e..b8270113a7 100644 --- a/src/mod/applications/mod_conference/conference_record.c +++ b/src/mod/applications/mod_conference/conference_record.c @@ -328,7 +328,7 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v goto end; } - while (conference_utils_member_test_flag(member, MFLAG_RUNNING) && conference_utils_test_flag(conference, CFLAG_RUNNING) && (conference->count + conference->count_ghosts)) { + while (conference_utils_member_test_flag(member, MFLAG_RUNNING) && conference_utils_test_flag(conference, CFLAG_RUNNING) && (conference->count + conference->count_ghosts) > 0) { len = 0; diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index ba736bcea1..71fb0889d5 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -203,7 +203,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int if (border > 50) border = 50; } - if (x < 0 || y < 0 || scale < 0 || !name) { + if (x < 0 || y < 0 || scale < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid image\n"); continue; } @@ -297,7 +297,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int x_layout = switch_xml_child(x_group, "layout"); - if (!name || !x_group || !x_layout) { + if (!name || !x_layout) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid group\n"); continue; } @@ -419,7 +419,7 @@ void conference_video_reset_layer(mcu_layer_t *layer) conference_video_reset_layer_cam(layer); - if (layer->geometry.overlap) { + if (layer->geometry.overlap && layer->canvas) { layer->canvas->refresh = 1; } @@ -820,7 +820,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, if (layer->manual_border) { border = layer->manual_border; - } if (layer->geometry.border) { + } else if (layer->geometry.border) { border = layer->geometry.border; } @@ -2450,7 +2450,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo return; } - if (conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) { + if (conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN) || !member->conference) { return; } @@ -2508,9 +2508,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo if (force && !member->avatar_png_img && member->video_mute_img) { switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT); - if (member->conference) { - conference_event_add_data(member->conference, event); - } + conference_event_add_data(member->conference, event); conference_member_add_event_data(member, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "vfi-triggered-member"); switch_event_fire(&event); @@ -2555,7 +2553,7 @@ void conference_video_check_flush(conference_member_t *member, switch_bool_t for void conference_video_patch_fnode(mcu_canvas_t *canvas, conference_file_node_t *fnode) { - if (fnode && fnode->layer_id > -1) { + if (canvas && fnode && fnode->layer_id > -1) { mcu_layer_t *layer = &canvas->layers[fnode->layer_id]; switch_frame_t file_frame = { 0 }; switch_status_t status = switch_core_file_read_video(&fnode->fh, &file_frame, SVR_FLUSH); @@ -2580,10 +2578,8 @@ void conference_video_patch_fnode(mcu_canvas_t *canvas, conference_file_node_t * layer->tagged = 1; } else if (status == SWITCH_STATUS_IGNORE) { - if (canvas && fnode->layer_id > -1 ) { - conference_video_canvas_del_fnode_layer(canvas->conference, fnode); - fnode->canvas_id = canvas->canvas_id; - } + conference_video_canvas_del_fnode_layer(canvas->conference, fnode); + fnode->canvas_id = canvas->canvas_id; } } } @@ -2663,8 +2659,7 @@ switch_status_t conference_video_find_layer(conference_obj_t *conference, mcu_ca } } - if (!layer && - (canvas->layers_used < canvas->total_layers || + if ((canvas->layers_used < canvas->total_layers || (avatar_layers && !member->avatar_png_img) || conference_utils_member_test_flag(member, MFLAG_MOD)) && (member->avatar_png_img || (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE))) { @@ -3233,7 +3228,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr if (imember->channel && switch_channel_ready(imember->channel) && switch_channel_test_flag(imember->channel, CF_VIDEO_READY) && !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN) && !hold && - conference_utils_member_test_flag(imember, MFLAG_RUNNING) && (!no_muted || seen) && (!no_av || (no_av && !imember->avatar_png_img)) + conference_utils_member_test_flag(imember, MFLAG_RUNNING) && (!no_muted || seen) && (!(no_av && imember->avatar_png_img)) && imember->canvas_id == canvas->canvas_id && imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY && imember->video_media_flow != SWITCH_MEDIA_FLOW_INACTIVE) { video_count++; } @@ -3688,7 +3683,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr (!conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) || (conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN) && !conference_utils_member_test_flag(imember, MFLAG_HOLD))) && imember->session && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && - imember->session && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE) { + switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE) { total--; } @@ -4001,13 +3996,11 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr canvas->refresh++; } - if (layer->cur_img) { - if (layer->member && switch_core_cpu_count() > 2) { - layer->need_patch = 1; - conference_video_wake_layer_thread(layer->member); - } else { - conference_video_scale_and_patch(layer, NULL, SWITCH_FALSE); - } + if (layer->member && switch_core_cpu_count() > 2) { + layer->need_patch = 1; + conference_video_wake_layer_thread(layer->member); + } else { + conference_video_scale_and_patch(layer, NULL, SWITCH_FALSE); } layer->tagged = 0; @@ -4030,13 +4023,11 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr canvas->refresh++; } - if (layer->cur_img) { - if (layer->member && switch_core_cpu_count() > 2) { - layer->need_patch = 1; - conference_video_wake_layer_thread(layer->member); - } else { - conference_video_scale_and_patch(layer, NULL, SWITCH_FALSE); - } + if (layer->member && switch_core_cpu_count() > 2) { + layer->need_patch = 1; + conference_video_wake_layer_thread(layer->member); + } else { + conference_video_scale_and_patch(layer, NULL, SWITCH_FALSE); } } } @@ -4725,7 +4716,7 @@ void conference_video_set_floor_holder(conference_obj_t *conference, conference_ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Setting floor not allowed on a member in a dedicated layer\n"); } - if ((!force && conference_utils_test_flag(conference, CFLAG_VID_FLOOR_LOCK))) { + if (!force && conference_utils_test_flag(conference, CFLAG_VID_FLOOR_LOCK)) { return; } @@ -4880,7 +4871,7 @@ void conference_video_write_frame(conference_obj_t *conference, conference_membe switch_channel_clear_flag(imember->channel, CF_VIDEO_REFRESH_REQ); } - if (isession && switch_channel_test_flag(imember->channel, CF_VIDEO_READY)) { + if (switch_channel_test_flag(imember->channel, CF_VIDEO_READY)) { int send_frame = 0; if (conference->canvases[0] && conference_utils_test_flag(imember->conference, CFLAG_VIDEO_BRIDGE_FIRST_TWO)) { @@ -5065,18 +5056,16 @@ switch_status_t conference_video_thread_callback(switch_core_session_t *session, } - if (member) { - if (member->id == member->conference->video_floor_holder) { - conference_video_write_frame(member->conference, member, frame); - conference_video_check_recording(member->conference, NULL, frame); - } else if (!conference_utils_test_flag(member->conference, CFLAG_VID_FLOOR_LOCK) && member->id == member->conference->last_video_floor_holder) { - conference_member_t *fmember; + if (member->id == member->conference->video_floor_holder) { + conference_video_write_frame(member->conference, member, frame); + conference_video_check_recording(member->conference, NULL, frame); + } else if (!conference_utils_test_flag(member->conference, CFLAG_VID_FLOOR_LOCK) && member->id == member->conference->last_video_floor_holder) { + conference_member_t *fmember; - if ((fmember = conference_member_get(member->conference, member->conference->video_floor_holder))) { - if (!conference_utils_member_test_flag(fmember, MFLAG_RECEIVING_VIDEO)) - switch_core_session_write_video_frame(fmember->session, frame, SWITCH_IO_FLAG_NONE, 0); - switch_thread_rwlock_unlock(fmember->rwlock); - } + if ((fmember = conference_member_get(member->conference, member->conference->video_floor_holder))) { + if (!conference_utils_member_test_flag(fmember, MFLAG_RECEIVING_VIDEO)) + switch_core_session_write_video_frame(fmember->session, frame, SWITCH_IO_FLAG_NONE, 0); + switch_thread_rwlock_unlock(fmember->rwlock); } } diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 5562272309..74894014bd 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1841,6 +1841,7 @@ switch_status_t conference_text_thread_callback(switch_core_session_t *session, if (inuse + 1 > member->text_framesize) { void *tmp = malloc(inuse + 1024); + switch_assert(tmp); memcpy(tmp, member->text_framedata, member->text_framesize); switch_assert(tmp); @@ -2029,10 +2030,8 @@ SWITCH_STANDARD_APP(conference_function) /* if this is a bridging call, and it's not a duplicate, build a */ /* conference object, and skip pin handling, and locked checking */ - if (!locked) { - switch_mutex_lock(conference_globals.setup_mutex); - locked = 1; - } + switch_mutex_lock(conference_globals.setup_mutex); + locked = 1; if (isbr) { char *uuid = switch_core_session_get_uuid(session); @@ -2057,10 +2056,8 @@ SWITCH_STANDARD_APP(conference_function) conference->flags[CFLAG_JSON_STATUS] = 1; conference_utils_set_cflags(cflags_str, conference->flags); - if (locked) { - switch_mutex_unlock(conference_globals.setup_mutex); - locked = 0; - } + switch_mutex_unlock(conference_globals.setup_mutex); + locked = 0; switch_channel_set_variable(channel, "conference_name", conference->name); @@ -2086,10 +2083,8 @@ SWITCH_STANDARD_APP(conference_function) } if ((conference = conference_find(conference_name, NULL))) { - if (locked) { - switch_mutex_unlock(conference_globals.setup_mutex); - locked = 0; - } + switch_mutex_unlock(conference_globals.setup_mutex); + locked = 0; } /* if the conference exists, get the pointer to it */ @@ -2267,7 +2262,7 @@ SWITCH_STANDARD_APP(conference_function) } while (!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) { - size_t dpin_length = dpin ? strlen(dpin) : 0; + size_t dpin_length = strlen(dpin); size_t mdpin_length = mdpin ? strlen(mdpin) : 0; int maxpin = dpin_length > mdpin_length ? (int)dpin_length : (int)mdpin_length; switch_status_t pstatus = SWITCH_STATUS_FALSE; @@ -2361,10 +2356,8 @@ SWITCH_STANDARD_APP(conference_function) } /* Release the config registry handle */ - if (cxml) { - switch_xml_free(cxml); - cxml = NULL; - } + switch_xml_free(cxml); + cxml = NULL; /* if we're using "bridge:" make an outbound call and bridge it in */ if (!zstr(bridgeto) && strcasecmp(bridgeto, "none")) { @@ -3308,10 +3301,10 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co video_layout_name = CONFERENCE_MUX_DEFAULT_LAYOUT; } - if (!strncasecmp(video_layout_name, "group:", 6)) { - video_layout_group = video_layout_name + 6; - } if (video_layout_name) { + if (!strncasecmp(video_layout_name, "group:", 6)) { + video_layout_group = video_layout_name + 6; + } conference->video_layout_name = switch_core_strdup(conference->pool, video_layout_name); } @@ -3516,9 +3509,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co if (conference->max_energy_hit_trigger < 0) { conference->max_energy_hit_trigger = 0; } - } - if (!zstr(max_energy_level)) { conference->max_energy_level = atoi(max_energy_level); if (conference->max_energy_level < 0) { conference->max_energy_level = 0;