va: no need to provide a buffer size for VA pool

VA drivers allocate surfaces given their properties, so there's no need to
provide a buffer size to the VA pool.

Though, the buffer size is provided by the driver, or the canonical size
is used for single planed surfaces.

This patch removes the need to provide a size for the function
gst_va_pool_new_with_config() and adds a helper method to retrieve the surface
size, gst_va_pool_get_buffer_size(). Also change the callers accordingly.

Changes for custom VA pool creation will be addressed in the following commits.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5805>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-12-13 10:20:33 +01:00
parent fab1c5f953
commit 4a22cc8fb3
12 changed files with 81 additions and 76 deletions

View file

@ -794,10 +794,6 @@ the most widely used VA drivers.</doc>
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">the #GstCaps of the buffers handled by the new pool.</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">the #GstCaps of the buffers handled by the new pool.</doc>
<type name="Gst.Caps" c:type="GstCaps*"/> <type name="Gst.Caps" c:type="GstCaps*"/>
</parameter> </parameter>
<parameter name="size" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">the size of the frames to hold.</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="min_buffers" transfer-ownership="none"> <parameter name="min_buffers" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">minimum number of frames to create.</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">minimum number of frames to create.</doc>
<type name="guint" c:type="guint"/> <type name="guint" c:type="guint"/>
@ -825,6 +821,24 @@ the most widely used VA drivers.</doc>
</parameter> </parameter>
</parameters> </parameters>
</constructor> </constructor>
<function name="get_buffer_size" c:identifier="gst_va_pool_get_buffer_size" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">Helper function to retrieve the VA surface size provided by @pool.</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">whether the surface size was retrieved.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<parameter name="pool" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">a #GstBufferPool</doc>
<type name="Gst.BufferPool" c:type="GstBufferPool*"/>
</parameter>
<parameter name="size" direction="out" caller-allocates="0" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">the declared surface size</doc>
<type name="guint" c:type="guint*"/>
</parameter>
</parameters>
</function>
<function name="requires_video_meta" c:identifier="gst_va_pool_requires_video_meta" version="1.22"> <function name="requires_video_meta" c:identifier="gst_va_pool_requires_video_meta" version="1.22">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">Retuns: %TRUE if @pool always add #GstVideoMeta to its <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c">Retuns: %TRUE if @pool always add #GstVideoMeta to its
buffers. Otherwise, %FALSE.</doc> buffers. Otherwise, %FALSE.</doc>

View file

@ -465,7 +465,6 @@ gst_buffer_pool_config_set_va_alignment (GstStructure * config,
gboolean gboolean
gst_va_pool_requires_video_meta (GstBufferPool * pool) gst_va_pool_requires_video_meta (GstBufferPool * pool)
{ {
g_return_val_if_fail (GST_IS_VA_POOL (pool), FALSE); g_return_val_if_fail (GST_IS_VA_POOL (pool), FALSE);
return GST_VA_POOL (pool)->force_videometa; return GST_VA_POOL (pool)->force_videometa;
@ -474,7 +473,6 @@ gst_va_pool_requires_video_meta (GstBufferPool * pool)
/** /**
* gst_va_pool_new_with_config: * gst_va_pool_new_with_config:
* @caps: the #GstCaps of the buffers handled by the new pool. * @caps: the #GstCaps of the buffers handled by the new pool.
* @size: the size of the frames to hold.
* @min_buffers: minimum number of frames to create. * @min_buffers: minimum number of frames to create.
* @max_buffers: maximum number of frames to create. * @max_buffers: maximum number of frames to create.
* @usage_hint: VA usage hint * @usage_hint: VA usage hint
@ -490,7 +488,7 @@ gst_va_pool_requires_video_meta (GstBufferPool * pool)
* Since: 1.22 * Since: 1.22
*/ */
GstBufferPool * GstBufferPool *
gst_va_pool_new_with_config (GstCaps * caps, guint size, guint min_buffers, gst_va_pool_new_with_config (GstCaps * caps, guint min_buffers,
guint max_buffers, guint usage_hint, GstVaFeature use_derived, guint max_buffers, guint usage_hint, GstVaFeature use_derived,
GstAllocator * allocator, GstAllocationParams * alloc_params) GstAllocator * allocator, GstAllocationParams * alloc_params)
{ {
@ -500,8 +498,8 @@ gst_va_pool_new_with_config (GstCaps * caps, guint size, guint min_buffers,
pool = gst_va_pool_new (); pool = gst_va_pool_new ();
config = gst_buffer_pool_get_config (pool); config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set_params (config, caps, size, min_buffers, /* ignore the size since it's calculated by the driver */
max_buffers); gst_buffer_pool_config_set_params (config, caps, 0, min_buffers, max_buffers);
gst_buffer_pool_config_set_va_allocation_params (config, usage_hint, gst_buffer_pool_config_set_va_allocation_params (config, usage_hint,
use_derived); use_derived);
gst_buffer_pool_config_set_allocator (config, allocator, alloc_params); gst_buffer_pool_config_set_allocator (config, allocator, alloc_params);
@ -512,3 +510,28 @@ gst_va_pool_new_with_config (GstCaps * caps, guint size, guint min_buffers,
return pool; return pool;
} }
/**
* gst_va_pool_get_buffer_size:
* @pool: a #GstBufferPool
* @size: (out) (allow-null-none): the declared surface size
*
* Helper function to retrieve the VA surface size provided by @pool.
*
* Returns: whether the surface size was retrieved.
*
* Since: 1.24
*/
gboolean
gst_va_pool_get_buffer_size (GstBufferPool * pool, guint * size)
{
gboolean ret;
GstStructure *config;
g_return_val_if_fail (GST_IS_VA_POOL (pool), FALSE);
config = gst_buffer_pool_get_config (pool);
ret = gst_buffer_pool_config_get_params (config, NULL, size, NULL, NULL);
gst_structure_free (config);
return ret && *size > 0;
}

View file

@ -48,12 +48,14 @@ void gst_buffer_pool_config_set_va_alignment (GstStructure * con
const GstVideoAlignment * align); const GstVideoAlignment * align);
GST_VA_API GST_VA_API
GstBufferPool * gst_va_pool_new_with_config (GstCaps * caps, GstBufferPool * gst_va_pool_new_with_config (GstCaps * caps,
guint size,
guint min_buffers, guint min_buffers,
guint max_buffers, guint max_buffers,
guint usage_hint, guint usage_hint,
GstVaFeature use_derived, GstVaFeature use_derived,
GstAllocator * allocator, GstAllocator * allocator,
GstAllocationParams * alloc_params); GstAllocationParams * alloc_params);
GST_VA_API
gboolean gst_va_pool_get_buffer_size (GstBufferPool * pool,
guint * size);
G_END_DECLS G_END_DECLS

View file

@ -1772,9 +1772,7 @@ gst_msdk_create_va_pool (GstMsdkDec * thiz, GstVideoInfo * info,
caps = gst_video_info_to_caps (info); caps = gst_video_info_to_caps (info);
} }
pool = pool = gst_va_pool_new_with_config (caps, num_buffers, num_buffers,
gst_va_pool_new_with_config (caps,
GST_VIDEO_INFO_SIZE (info), num_buffers, num_buffers,
VA_SURFACE_ATTRIB_USAGE_HINT_DECODER, GST_VA_FEATURE_AUTO, VA_SURFACE_ATTRIB_USAGE_HINT_DECODER, GST_VA_FEATURE_AUTO,
allocator, &alloc_params); allocator, &alloc_params);

View file

@ -1200,9 +1200,8 @@ gst_msdk_create_va_pool (GstMsdkEnc * thiz, GstVideoInfo * info,
} else } else
aligned_caps = gst_video_info_to_caps (info); aligned_caps = gst_video_info_to_caps (info);
pool = pool = gst_va_pool_new_with_config (aligned_caps, num_buffers, 0,
gst_va_pool_new_with_config (aligned_caps, GST_VIDEO_INFO_SIZE (info), VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC, GST_VA_FEATURE_AUTO,
num_buffers, 0, VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC, GST_VA_FEATURE_AUTO,
allocator, &alloc_params); allocator, &alloc_params);
gst_object_unref (allocator); gst_object_unref (allocator);

View file

@ -429,10 +429,8 @@ gst_msdk_create_va_pool (GstMsdkVPP * thiz, GstVideoInfo * info,
} else } else
aligned_caps = gst_video_info_to_caps (info); aligned_caps = gst_video_info_to_caps (info);
pool = pool = gst_va_pool_new_with_config (aligned_caps, min_buffers, 0, usage_hint,
gst_va_pool_new_with_config (aligned_caps, GST_VA_FEATURE_AUTO, allocator, &alloc_params);
GST_VIDEO_INFO_SIZE (info), min_buffers, 0,
usage_hint, GST_VA_FEATURE_AUTO, allocator, &alloc_params);
gst_object_unref (allocator); gst_object_unref (allocator);
gst_caps_unref (aligned_caps); gst_caps_unref (aligned_caps);

View file

@ -981,8 +981,7 @@ gst_qsv_encoder_prepare_va_pool (GstQsvEncoder * self,
gst_allocation_params_init (&params); gst_allocation_params_init (&params);
priv->internal_pool = gst_va_pool_new_with_config (caps, priv->internal_pool = gst_va_pool_new_with_config (caps, 0, 0,
GST_VIDEO_INFO_SIZE (aligned_info), 0, 0,
VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC, GST_VA_FEATURE_AUTO, VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC, GST_VA_FEATURE_AUTO,
allocator, &params); allocator, &params);
gst_object_unref (allocator); gst_object_unref (allocator);
@ -1592,8 +1591,7 @@ gst_qsv_encoder_propose_allocation (GstVideoEncoder * encoder, GstQuery * query)
return FALSE; return FALSE;
} }
pool = gst_va_pool_new_with_config (caps, pool = gst_va_pool_new_with_config (caps, priv->surface_pool->len, 0,
GST_VIDEO_INFO_SIZE (&info), priv->surface_pool->len, 0,
VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC, GST_VA_FEATURE_AUTO, VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC, GST_VA_FEATURE_AUTO,
allocator, &params); allocator, &params);

View file

@ -293,8 +293,8 @@ _create_internal_pool (GstVaAV1Dec * self, gint width, gint height)
usage_hint = va_get_surface_usage_hint (base->display, usage_hint = va_get_surface_usage_hint (base->display,
VAEntrypointVLD, GST_PAD_SRC, FALSE); VAEntrypointVLD, GST_PAD_SRC, FALSE);
pool = gst_va_pool_new_with_config (caps, GST_VIDEO_INFO_SIZE (&info), pool = gst_va_pool_new_with_config (caps, 1, 0, usage_hint,
1, 0, usage_hint, GST_VA_FEATURE_AUTO, allocator, &params); GST_VA_FEATURE_AUTO, allocator, &params);
gst_clear_caps (&caps); gst_clear_caps (&caps);
gst_object_unref (allocator); gst_object_unref (allocator);

View file

@ -201,7 +201,7 @@ _get_sinkpad_pool (GstElement * element, gpointer data)
GstVaBaseEnc *base = GST_VA_BASE_ENC (element); GstVaBaseEnc *base = GST_VA_BASE_ENC (element);
GstAllocator *allocator; GstAllocator *allocator;
GstAllocationParams params = { 0, }; GstAllocationParams params = { 0, };
guint size, usage_hint; guint usage_hint;
GArray *surface_formats = NULL; GArray *surface_formats = NULL;
GstCaps *caps = NULL; GstCaps *caps = NULL;
@ -219,8 +219,6 @@ _get_sinkpad_pool (GstElement * element, gpointer data)
gst_allocation_params_init (&params); gst_allocation_params_init (&params);
size = GST_VIDEO_INFO_SIZE (&base->in_info);
surface_formats = gst_va_encoder_get_surface_formats (base->encoder); surface_formats = gst_va_encoder_get_surface_formats (base->encoder);
allocator = gst_va_allocator_new (base->display, surface_formats); allocator = gst_va_allocator_new (base->display, surface_formats);
@ -228,8 +226,8 @@ _get_sinkpad_pool (GstElement * element, gpointer data)
usage_hint = va_get_surface_usage_hint (base->display, usage_hint = va_get_surface_usage_hint (base->display,
VAEntrypointEncSlice, GST_PAD_SINK, FALSE); VAEntrypointEncSlice, GST_PAD_SINK, FALSE);
base->priv->raw_pool = gst_va_pool_new_with_config (caps, size, 1, 0, base->priv->raw_pool = gst_va_pool_new_with_config (caps, 1, 0, usage_hint,
usage_hint, GST_VA_FEATURE_AUTO, allocator, &params); GST_VA_FEATURE_AUTO, allocator, &params);
gst_clear_caps (&caps); gst_clear_caps (&caps);
if (!base->priv->raw_pool) { if (!base->priv->raw_pool) {
@ -356,38 +354,33 @@ gst_va_base_enc_propose_allocation (GstVideoEncoder * venc, GstQuery * query)
GstAllocationParams params = { 0, }; GstAllocationParams params = { 0, };
GstBufferPool *pool; GstBufferPool *pool;
GstCaps *caps; GstCaps *caps;
GstVideoInfo info;
gboolean need_pool = FALSE; gboolean need_pool = FALSE;
guint size, usage_hint; guint size = 0, usage_hint;
gst_query_parse_allocation (query, &caps, &need_pool); gst_query_parse_allocation (query, &caps, &need_pool);
if (!caps) if (!caps)
return FALSE; return FALSE;
if (!gst_video_info_from_caps (&info, caps)) {
GST_ERROR_OBJECT (base, "Cannot parse caps %" GST_PTR_FORMAT, caps);
return FALSE;
}
usage_hint = va_get_surface_usage_hint (base->display, usage_hint = va_get_surface_usage_hint (base->display,
VAEntrypointEncSlice, GST_PAD_SINK, gst_video_is_dma_drm_caps (caps)); VAEntrypointEncSlice, GST_PAD_SINK, gst_video_is_dma_drm_caps (caps));
size = GST_VIDEO_INFO_SIZE (&info);
gst_allocation_params_init (&params); gst_allocation_params_init (&params);
if (!(allocator = _allocator_from_caps (base, caps))) if (!(allocator = _allocator_from_caps (base, caps)))
return FALSE; return FALSE;
pool = gst_va_pool_new_with_config (caps, size, 1, 0, usage_hint, pool = gst_va_pool_new_with_config (caps, 1, 0, usage_hint,
GST_VA_FEATURE_AUTO, allocator, &params); GST_VA_FEATURE_AUTO, allocator, &params);
if (!pool) { if (!pool) {
gst_object_unref (allocator); gst_object_unref (allocator);
goto config_failed; goto config_failed;
} }
if (!gst_va_pool_get_buffer_size (pool, &size))
goto config_failed;
gst_query_add_allocation_param (query, allocator, &params); gst_query_add_allocation_param (query, allocator, &params);
gst_query_add_allocation_pool (query, pool, size, 0, 0); gst_query_add_allocation_pool (query, pool, size, 1, 0);
GST_DEBUG_OBJECT (base, GST_DEBUG_OBJECT (base,
"proposing %" GST_PTR_FORMAT " with allocator %" GST_PTR_FORMAT, "proposing %" GST_PTR_FORMAT " with allocator %" GST_PTR_FORMAT,

View file

@ -240,7 +240,6 @@ gst_va_base_transform_propose_allocation (GstBaseTransform * trans,
GstAllocationParams params = { 0, }; GstAllocationParams params = { 0, };
GstBufferPool *pool; GstBufferPool *pool;
GstCaps *caps; GstCaps *caps;
GstVideoInfo info;
gboolean update_allocator = FALSE; gboolean update_allocator = FALSE;
guint size, usage_hint; guint size, usage_hint;
@ -261,16 +260,9 @@ gst_va_base_transform_propose_allocation (GstBaseTransform * trans,
if (!caps) if (!caps)
return FALSE; return FALSE;
if (!gst_va_video_info_from_caps (&info, NULL, caps)) {
GST_ERROR_OBJECT (self, "Cannot parse caps %" GST_PTR_FORMAT, caps);
return FALSE;
}
usage_hint = va_get_surface_usage_hint (self->display, usage_hint = va_get_surface_usage_hint (self->display,
VAEntrypointVideoProc, GST_PAD_SINK, gst_video_is_dma_drm_caps (caps)); VAEntrypointVideoProc, GST_PAD_SINK, gst_video_is_dma_drm_caps (caps));
size = GST_VIDEO_INFO_SIZE (&info);
if (gst_query_get_n_allocation_params (query) > 0) { if (gst_query_get_n_allocation_params (query) > 0) {
gst_query_parse_nth_allocation_param (query, 0, &allocator, &params); gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
if (!GST_IS_VA_DMABUF_ALLOCATOR (allocator) if (!GST_IS_VA_DMABUF_ALLOCATOR (allocator)
@ -286,8 +278,8 @@ gst_va_base_transform_propose_allocation (GstBaseTransform * trans,
return FALSE; return FALSE;
} }
pool = gst_va_pool_new_with_config (caps, size, 1 + self->extra_min_buffers, pool = gst_va_pool_new_with_config (caps, 1 + self->extra_min_buffers, 0,
0, usage_hint, GST_VA_FEATURE_AUTO, allocator, &params); usage_hint, GST_VA_FEATURE_AUTO, allocator, &params);
if (!pool) { if (!pool) {
gst_object_unref (allocator); gst_object_unref (allocator);
goto config_failed; goto config_failed;
@ -298,6 +290,9 @@ gst_va_base_transform_propose_allocation (GstBaseTransform * trans,
else else
gst_query_add_allocation_param (query, allocator, &params); gst_query_add_allocation_param (query, allocator, &params);
if (!gst_va_pool_get_buffer_size (pool, &size))
goto config_failed;
gst_query_add_allocation_pool (query, pool, size, 1 + self->extra_min_buffers, gst_query_add_allocation_pool (query, pool, size, 1 + self->extra_min_buffers,
0); 0);
@ -760,8 +755,7 @@ _get_sinkpad_pool (GstElement * element, gpointer data)
GstAllocator *allocator; GstAllocator *allocator;
GstAllocationParams params = { 0, }; GstAllocationParams params = { 0, };
GstCaps *caps; GstCaps *caps;
GstVideoInfo in_info; guint usage_hint;
guint size, usage_hint;
if (self->priv->sinkpad_pool) if (self->priv->sinkpad_pool)
return self->priv->sinkpad_pool; return self->priv->sinkpad_pool;
@ -787,21 +781,13 @@ _get_sinkpad_pool (GstElement * element, gpointer data)
gst_caps_set_simple (caps, "height", G_TYPE_INT, gst_caps_set_simple (caps, "height", G_TYPE_INT,
self->priv->uncropped_height, NULL); self->priv->uncropped_height, NULL);
if (!gst_video_info_from_caps (&in_info, caps)) {
GST_ERROR_OBJECT (self, "Cannot parse caps %" GST_PTR_FORMAT, caps);
gst_caps_unref (caps);
return NULL;
}
usage_hint = va_get_surface_usage_hint (self->display, usage_hint = va_get_surface_usage_hint (self->display,
VAEntrypointVideoProc, GST_PAD_SINK, FALSE); VAEntrypointVideoProc, GST_PAD_SINK, FALSE);
size = GST_VIDEO_INFO_SIZE (&in_info);
allocator = gst_va_base_transform_allocator_from_caps (self, caps); allocator = gst_va_base_transform_allocator_from_caps (self, caps);
g_assert (GST_IS_VA_ALLOCATOR (allocator)); g_assert (GST_IS_VA_ALLOCATOR (allocator));
self->priv->sinkpad_pool = gst_va_pool_new_with_config (caps, size, 1, 0, self->priv->sinkpad_pool = gst_va_pool_new_with_config (caps, 1, 0,
usage_hint, GST_VA_FEATURE_AUTO, allocator, &params); usage_hint, GST_VA_FEATURE_AUTO, allocator, &params);
if (!self->priv->sinkpad_pool) { if (!self->priv->sinkpad_pool) {
gst_caps_unref (caps); gst_caps_unref (caps);

View file

@ -580,8 +580,6 @@ gst_va_compositor_propose_allocation (GstAggregator * agg,
usage_hint = va_get_surface_usage_hint (self->display, usage_hint = va_get_surface_usage_hint (self->display,
VAEntrypointVideoProc, GST_PAD_SINK, gst_video_is_dma_drm_caps (caps)); VAEntrypointVideoProc, GST_PAD_SINK, gst_video_is_dma_drm_caps (caps));
size = GST_VIDEO_INFO_SIZE (&info);
if (gst_query_get_n_allocation_params (query) > 0) { if (gst_query_get_n_allocation_params (query) > 0) {
gst_query_parse_nth_allocation_param (query, 0, &allocator, &params); gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
if (!GST_IS_VA_DMABUF_ALLOCATOR (allocator) if (!GST_IS_VA_DMABUF_ALLOCATOR (allocator)
@ -599,13 +597,16 @@ gst_va_compositor_propose_allocation (GstAggregator * agg,
/* Now we have a VA-based allocator */ /* Now we have a VA-based allocator */
pool = gst_va_pool_new_with_config (caps, size, 1, 0, usage_hint, pool = gst_va_pool_new_with_config (caps, 1, 0, usage_hint,
GST_VA_FEATURE_AUTO, allocator, &params); GST_VA_FEATURE_AUTO, allocator, &params);
if (!pool) { if (!pool) {
gst_object_unref (allocator); gst_object_unref (allocator);
goto config_failed; goto config_failed;
} }
if (!gst_va_pool_get_buffer_size (pool, &size))
goto config_failed;
if (update_allocator) if (update_allocator)
gst_query_set_nth_allocation_param (query, 0, allocator, &params); gst_query_set_nth_allocation_param (query, 0, allocator, &params);
else else
@ -803,7 +804,7 @@ _get_sinkpad_pool (GstElement * element, gpointer data)
GstAllocationParams params = { 0, }; GstAllocationParams params = { 0, };
GstCaps *caps; GstCaps *caps;
GstVideoInfo info; GstVideoInfo info;
guint size, usage_hint; guint usage_hint;
if (pad->pool) if (pad->pool)
return pad->pool; return pad->pool;
@ -822,10 +823,8 @@ _get_sinkpad_pool (GstElement * element, gpointer data)
usage_hint = va_get_surface_usage_hint (self->display, usage_hint = va_get_surface_usage_hint (self->display,
VAEntrypointVideoProc, GST_PAD_SINK, FALSE); VAEntrypointVideoProc, GST_PAD_SINK, FALSE);
size = GST_VIDEO_INFO_SIZE (&info);
allocator = gst_va_compositor_allocator_from_caps (self, caps); allocator = gst_va_compositor_allocator_from_caps (self, caps);
pad->pool = gst_va_pool_new_with_config (caps, size, 1, 0, usage_hint, pad->pool = gst_va_pool_new_with_config (caps, 1, 0, usage_hint,
GST_VA_FEATURE_AUTO, allocator, &params); GST_VA_FEATURE_AUTO, allocator, &params);
gst_caps_unref (caps); gst_caps_unref (caps);

View file

@ -310,7 +310,6 @@ _create_reconstruct_pool (GstVaDisplay * display, GArray * surface_formats,
GstVideoInfo info; GstVideoInfo info;
GstAllocationParams params = { 0, }; GstAllocationParams params = { 0, };
GstBufferPool *pool; GstBufferPool *pool;
guint size;
GstCaps *caps = NULL; GstCaps *caps = NULL;
gst_video_info_set_format (&info, format, coded_width, coded_height); gst_video_info_set_format (&info, format, coded_width, coded_height);
@ -318,17 +317,13 @@ _create_reconstruct_pool (GstVaDisplay * display, GArray * surface_formats,
usage_hint = va_get_surface_usage_hint (display, usage_hint = va_get_surface_usage_hint (display,
VAEntrypointEncSlice, GST_PAD_SINK, FALSE); VAEntrypointEncSlice, GST_PAD_SINK, FALSE);
size = GST_VIDEO_INFO_SIZE (&info);
caps = gst_video_info_to_caps (&info); caps = gst_video_info_to_caps (&info);
gst_caps_set_features_simple (caps, gst_caps_set_features_simple (caps,
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_VA)); gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_VA));
allocator = gst_va_allocator_new (display, surface_formats); allocator = gst_va_allocator_new (display, surface_formats);
gst_allocation_params_init (&params); pool = gst_va_pool_new_with_config (caps, 0, max_buffers, usage_hint,
pool = gst_va_pool_new_with_config (caps, size, 0, max_buffers, usage_hint,
GST_VA_FEATURE_AUTO, allocator, &params); GST_VA_FEATURE_AUTO, allocator, &params);
gst_clear_object (&allocator); gst_clear_object (&allocator);