From ca9a62c53949a75b4f8c7119c072e4611839373f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2018 22:58:07 -0400 Subject: [PATCH] FS-11119: [core] Fix video skew on oddly resized conference layers --- src/switch_core_video.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 69e8f25032..66cbc6279f 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -532,18 +532,28 @@ SWITCH_DECLARE(void) switch_img_patch(switch_image_t *IMG, switch_image_t *img, SWITCH_DECLARE(void) switch_img_patch_rect(switch_image_t *IMG, int X, int Y, switch_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h) { #ifdef SWITCH_HAVE_VPX - switch_image_t *tmp; + switch_image_t *tmp = NULL; uint8_t *data; if (x >= img->d_w || y >= img->d_h) return; + if (w == img->d_w && h == img->d_h) { + switch_img_patch(IMG, img, X, Y); + return; + } + if (!(img->fmt & SWITCH_IMG_FMT_PLANAR)) { data = img->planes[SWITCH_PLANE_PACKED]; } else { data = img->planes[SWITCH_PLANE_Y]; } - tmp = (switch_image_t *)vpx_img_wrap(NULL, img->fmt, img->d_w, img->d_h, 1, data); + if (img->d_w == img->stride[0]) { + tmp = (switch_image_t *)vpx_img_wrap(NULL, img->fmt, img->d_w, img->d_h, 1, data); + } else { + switch_img_copy(img, &tmp); + } + if (!tmp) return; w = MIN(img->d_w - x, w);