]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11119: [core] Fix video skew on oddly resized conference layers
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 8 May 2018 02:58:07 +0000 (22:58 -0400)
committerMuteesa Fred <muteesafred@hotmail.com>
Tue, 24 Jul 2018 07:21:52 +0000 (07:21 +0000)
src/switch_core_video.c

index 69e8f25032b70a70bc0bc2e5e9b1654923699c54..66cbc6279f53e3a2f241799c5d641d01134f962d 100644 (file)
@@ -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);