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, has_video_crop_meta = has_videometa && gst_query_find_allocation_meta (query,
GST_VIDEO_CROP_META_API_TYPE, NULL); 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, /* 1. The output picture locates in the middle of the decoded buffer,
but the downstream element does not support VideoCropMeta, we but the downstream element does not support VideoCropMeta, we
definitely need a copy. definitely need a copy.

View File

@ -338,6 +338,14 @@ gst_va_base_transform_decide_allocation (GstBaseTransform * trans,
if (!outcaps) if (!outcaps)
return FALSE; 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) { if (gst_query_get_n_allocation_params (query) > 0) {
GstVaDisplay *display; GstVaDisplay *display;
@ -423,9 +431,6 @@ gst_va_base_transform_decide_allocation (GstBaseTransform * trans,
else else
gst_query_add_allocation_pool (query, pool, size, min, max); 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) copy_frames = (!has_videometa && gst_va_pool_requires_video_meta (pool)
&& gst_caps_is_raw (outcaps)); && gst_caps_is_raw (outcaps));
if (copy_frames) { if (copy_frames) {

View File

@ -666,6 +666,14 @@ gst_va_compositor_decide_allocation (GstAggregator * agg, GstQuery * query)
if (!caps) if (!caps)
return FALSE; 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) { if (gst_query_get_n_allocation_params (query) > 0) {
GstVaDisplay *display; GstVaDisplay *display;
@ -762,9 +770,6 @@ gst_va_compositor_decide_allocation (GstAggregator * agg, GstQuery * query)
else else
gst_query_add_allocation_pool (query, pool, size, min, max); 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) copy_frames = (!has_videometa && gst_va_pool_requires_video_meta (pool)
&& gst_caps_is_raw (caps)); && gst_caps_is_raw (caps));
if (copy_frames) { if (copy_frames) {