1From 435b81d9a824e535268728d8042ffeae0ca239ec Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Fri, 15 Jul 2022 12:14:44 +0800
4Subject: [PATCH 35/41] waylandsink: Fix buffer size error when video cropped
5
6Prefer video meta's size instead of the cropped size from caps.
7
8Tested with:
9gst-launch-1.0 videotestsrc ! videocrop left=100 ! waylandsink
10
11Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
12---
13 ext/wayland/gstwaylandsink.c | 4 ++++
14 1 file changed, 4 insertions(+)
15
16diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
17index 183529a..a962c61 100644
18--- a/ext/wayland/gstwaylandsink.c
19+++ b/ext/wayland/gstwaylandsink.c
20@@ -1040,6 +1040,10 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
21   if (vmeta) {
22     gint i;
23
24+    /* prefer the padded width/height from vmeta */
25+    self->video_info.width = vmeta->width;
26+    self->video_info.height = vmeta->height;
27+
28     for (i = 0; i < vmeta->n_planes; i++) {
29       self->video_info.offset[i] = vmeta->offset[i];
30       self->video_info.stride[i] = vmeta->stride[i];
31--
322.20.1
33
34