From e7c5e2480a0bdfc764d0278b7bccd8547db8cd76 Mon Sep 17 00:00:00 2001 From: Sergey Khripchenko Date: Wed, 29 Aug 2018 05:46:56 -0700 Subject: [PATCH] FS-11364 Fix tile flicker when layout has 'overlap' and 'zoom' options Usually tiles recalculated when new image comes in, however when 'overlap' option is in effect - tiles recalculated multiple times. And when layout also has 'zoom' option - when image recalculated it each round zooms itself deeper and deeper, until new images comes and image resets to proper state. This looks like flicker. The fix is to always take for zoom calculations real image dimensions instead of previously recalculated. HOWEVER! There are too many math and corner cases in mod_conference, so i propose it to be reviewed by widest audience of people who wrote mod_conference! --- src/mod/applications/mod_conference/conference_video.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index f02a528b95..4cb48cca18 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -723,7 +723,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, crop_y = c_y; } - set_bounds(&crop_x, &crop_y, img->d_w, img->d_h, crop_w, crop_h); + set_bounds(&crop_x, &crop_y, img->w, img->h, crop_w, crop_h); //printf("ZOOM %d,%d %d,%d %dx%d\n", crop_x, crop_y, c_x, c_y, zoom_w, zoom_h); } @@ -745,7 +745,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, crop_x = use_geometry->x; } } else if (screen_aspect < img_aspect) { - crop_x = img->d_w / 4; + crop_x = img->w / 4; } if (can_pan) { @@ -755,7 +755,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, crop_y = use_geometry->y; } } else if (screen_aspect > img_aspect) { - crop_y = img->d_h / 4; + crop_y = img->h / 4; } crop_x = switch_round_to_step(crop_x, layer->cam_opts.snap_factor); @@ -763,7 +763,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, } //printf("BOUNDS B4 %d,%d %dx%d %dx%d\n", crop_x, crop_y, img->d_w, img->d_h, crop_w, crop_h); - set_bounds(&crop_x, &crop_y, img->d_w, img->d_h, crop_w, crop_h); + set_bounds(&crop_x, &crop_y, img->w, img->h, crop_w, crop_h); //printf("BOUNDS AF %d,%d %dx%d %dx%d\n", crop_x, crop_y, img->d_w, img->d_h, crop_w, crop_h); if (img_changed) { @@ -789,7 +789,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, layer->crop_h = layer->crop_w / screen_aspect; if (layer->crop_h > img->d_h) layer->crop_h = img->d_h; - set_bounds(&layer->crop_x, &layer->crop_y, img->d_w, img->d_h, layer->crop_w, layer->crop_h); + set_bounds(&layer->crop_x, &layer->crop_y, img->w, img->h, layer->crop_w, layer->crop_h); assert(layer->crop_w > 0);