vabase: fail decide allocation if dmabuf without videometa

If the allocation query received from downstream doesn't handle GstVideoMeta but
it requests memory:DMABuf caps feature, it's incomplete, so we rather reject the
negotiation.

Both in base decoder, base transform and compositor.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6155>
This commit is contained in:
Víctor Manuel Jáquez Leal 2024-02-20 17:28:29 +01:00 committed by GStreamer Marge Bot
parent 5422c6c6d4
commit cc7726ea39
3 changed files with 22 additions and 6 deletions

View file

@ -487,6 +487,12 @@ gst_va_base_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
has_video_crop_meta = has_videometa && gst_query_find_allocation_meta (query,
GST_VIDEO_CROP_META_API_TYPE, NULL);
if (gst_video_is_dma_drm_caps (caps) && !has_videometa) {
GST_ERROR_OBJECT (base,
"DMABuf caps negotiated without the mandatory support of VideoMeta ");
return FALSE;
}
/* 1. The output picture locates in the middle of the decoded buffer,
but the downstream element does not support VideoCropMeta, we
definitely need a copy.

View file

@ -338,6 +338,14 @@ gst_va_base_transform_decide_allocation (GstBaseTransform * trans,
if (!outcaps)
return FALSE;
has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);
if (gst_video_is_dma_drm_caps (outcaps) && !has_videometa) {
GST_ERROR_OBJECT (trans,
"DMABuf caps negotiated without the mandatory support of VideoMeta ");
return FALSE;
}
if (gst_query_get_n_allocation_params (query) > 0) {
GstVaDisplay *display;
@ -423,9 +431,6 @@ gst_va_base_transform_decide_allocation (GstBaseTransform * trans,
else
gst_query_add_allocation_pool (query, pool, size, min, max);
has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);
copy_frames = (!has_videometa && gst_va_pool_requires_video_meta (pool)
&& gst_caps_is_raw (outcaps));
if (copy_frames) {

View file

@ -666,6 +666,14 @@ gst_va_compositor_decide_allocation (GstAggregator * agg, GstQuery * query)
if (!caps)
return FALSE;
has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);
if (gst_video_is_dma_drm_caps (caps) && !has_videometa) {
GST_ERROR_OBJECT (self,
"DMABuf caps negotiated without the mandatory support of VideoMeta ");
return FALSE;
}
if (gst_query_get_n_allocation_params (query) > 0) {
GstVaDisplay *display;
@ -762,9 +770,6 @@ gst_va_compositor_decide_allocation (GstAggregator * agg, GstQuery * query)
else
gst_query_add_allocation_pool (query, pool, size, min, max);
has_videometa = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);
copy_frames = (!has_videometa && gst_va_pool_requires_video_meta (pool)
&& gst_caps_is_raw (caps));
if (copy_frames) {