From d799bb304156b305245ce9c6e3abc618c5097266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Mon, 21 Nov 2016 12:51:25 +0100 Subject: [PATCH] plugins: update the src pad allocator video info Update the size, stride and offset of the source pad allocator video info, so the pool could set the correct GstVideoMeta https://bugzilla.gnome.org/show_bug.cgi?id=774782 --- gst/vaapi/gstvaapipluginbase.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/gst/vaapi/gstvaapipluginbase.c b/gst/vaapi/gstvaapipluginbase.c index 147e5f283c..036533b027 100644 --- a/gst/vaapi/gstvaapipluginbase.c +++ b/gst/vaapi/gstvaapipluginbase.c @@ -559,8 +559,6 @@ ensure_srcpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo, if (different_caps) { vi = plugin->srcpad_info; - /* let's keep the size of the allocation info */ - GST_VIDEO_INFO_SIZE (&vi) = GST_VIDEO_INFO_SIZE (vinfo); } else { vi = *vinfo; } @@ -579,8 +577,23 @@ ensure_srcpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo, if (!plugin->srcpad_allocator) goto error_create_allocator; - if (different_caps) - gst_allocator_set_vaapi_video_info (plugin->srcpad_allocator, &vi, 0); + if (different_caps) { + guint i, flags = 0; + const GstVideoInfo *alloc_vi = + gst_allocator_get_vaapi_video_info (plugin->srcpad_allocator, &flags); + /* update the planes and the size with the allocator image info, + * but not the resolution */ + if (alloc_vi) { + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (alloc_vi); i++) { + GST_VIDEO_INFO_PLANE_OFFSET (&vi, i) = + GST_VIDEO_INFO_PLANE_OFFSET (alloc_vi, i); + GST_VIDEO_INFO_PLANE_STRIDE (&vi, i) = + GST_VIDEO_INFO_PLANE_STRIDE (alloc_vi, i); + } + GST_VIDEO_INFO_SIZE (&vi) = GST_VIDEO_INFO_SIZE (alloc_vi); + gst_allocator_set_vaapi_video_info (plugin->srcpad_allocator, &vi, flags); + } + } return TRUE;