From: Anthony Minessale Date: Tue, 11 Apr 2017 22:45:15 +0000 (-0500) Subject: FS-10225: [mod_conference] Incorrect layout chosen when playing a file in a conferenc... X-Git-Tag: v1.8.0~614 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2193bef0fbe4e65c712632217d77ee0a3a91df19;p=thirdparty%2Ffreeswitch.git FS-10225: [mod_conference] Incorrect layout chosen when playing a file in a conference with a layout group #resolve --- diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index ddf1bd5ed8..044d38f65f 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -1802,7 +1802,7 @@ void conference_video_write_canvas_image_to_codec_group(conference_obj_t *confer video_layout_t *conference_video_find_best_layout(conference_obj_t *conference, layout_group_t *lg, uint32_t count, uint32_t file_count) { - video_layout_node_t *vlnode = NULL, *last = NULL; + video_layout_node_t *vlnode = NULL, *last = NULL, *least = NULL; if (count == 1 && file_count == 1) file_count = 0; @@ -1822,19 +1822,30 @@ video_layout_t *conference_video_find_best_layout(conference_obj_t *conference, for (vlnode = lg->layouts; vlnode; vlnode = vlnode->next) { int x, file_layers = 0, member_count = (int)count - file_count, total = vlnode->vlayout->layers; + for (x = total; x >= 0; x--) { if (vlnode->vlayout->images[x].fileonly) { file_layers++; } } - if ((vlnode->vlayout->layers - file_layers >= member_count && file_layers >= file_count) || vlnode->vlayout->layers - file_layers > (int)count) { + if ((vlnode->vlayout->layers - file_layers >= member_count && file_layers >= file_count)) { break; } + if (vlnode->vlayout->layers - file_layers >= (int)count) { + if (!least || least->vlayout->layers > vlnode->vlayout->layers) { + least = vlnode; + } + } + last = vlnode; } + if (least) { + vlnode = least; + } + return vlnode? vlnode->vlayout : last ? last->vlayout : NULL; }