From a6b53cdfe06440019dc9825e45995afd90fec47e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 11 Apr 2017 17:45:15 -0500 Subject: [PATCH] FS-10225: [mod_conference] Incorrect layout chosen when playing a file in a conference with a layout group #resolve Conflicts: src/mod/applications/mod_conference/conference_video.c --- .../mod_conference/conference_video.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index acedda36d4..e9a8d5407c 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -1354,7 +1354,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; @@ -1373,20 +1373,31 @@ 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; }