va: dec, vpp: don't get buffer size from allocators

Since buffer size is now ignored by bufferpool there's no need to get tha value
from the allocator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-10-07 12:49:44 +02:00
parent e73b866fe0
commit 64eb0f0ed2
3 changed files with 17 additions and 29 deletions

View file

@ -1074,8 +1074,7 @@ _shall_copy_frames (GstVaH264Dec * self, GstVideoInfo * info)
}
static gboolean
_try_allocator (GstVaH264Dec * self, GstAllocator * allocator, GstCaps * caps,
guint * size)
_try_allocator (GstVaH264Dec * self, GstAllocator * allocator, GstCaps * caps)
{
GstVaAllocationParams params = {
.usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_DECODER,
@ -1100,14 +1099,11 @@ _try_allocator (GstVaH264Dec * self, GstAllocator * allocator, GstCaps * caps,
return FALSE;
}
if (size)
*size = GST_VIDEO_INFO_SIZE (&params.info);
return TRUE;
}
static GstAllocator *
_create_allocator (GstVaH264Dec * self, GstCaps * caps, guint * size)
_create_allocator (GstVaH264Dec * self, GstCaps * caps)
{
GstAllocator *allocator = NULL;
GstVaDisplay *display = NULL;
@ -1124,7 +1120,7 @@ _create_allocator (GstVaH264Dec * self, GstCaps * caps, guint * size)
gst_object_unref (display);
if (!_try_allocator (self, allocator, caps, size))
if (!_try_allocator (self, allocator, caps))
gst_clear_object (&allocator);
return allocator;
@ -1154,7 +1150,7 @@ gst_va_h264_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
GstStructure *config;
GstVideoInfo info;
GstVaH264Dec *self = GST_VA_H264_DEC (decoder);
guint size, min, max;
guint size = 0, min, max;
gboolean update_pool = FALSE, update_allocator = FALSE, has_videoalignment;
gst_query_parse_allocation (query, &caps, NULL);
@ -1225,7 +1221,7 @@ gst_va_h264_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
}
if (!allocator) {
if (!(allocator = _create_allocator (self, caps, &size)))
if (!(allocator = _create_allocator (self, caps)))
return FALSE;
}

View file

@ -393,8 +393,7 @@ _shall_copy_frames (GstVaVp8Dec * self, GstVideoInfo * info)
}
static gboolean
_try_allocator (GstVaVp8Dec * self, GstAllocator * allocator, GstCaps * caps,
guint * size)
_try_allocator (GstVaVp8Dec * self, GstAllocator * allocator, GstCaps * caps)
{
GstVaAllocationParams params = {
.usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_DECODER,
@ -415,14 +414,11 @@ _try_allocator (GstVaVp8Dec * self, GstAllocator * allocator, GstCaps * caps,
return FALSE;
}
if (size)
*size = GST_VIDEO_INFO_SIZE (&params.info);
return TRUE;
}
static GstAllocator *
_create_allocator (GstVaVp8Dec * self, GstCaps * caps, guint * size)
_create_allocator (GstVaVp8Dec * self, GstCaps * caps)
{
GstAllocator *allocator = NULL;
GstVaDisplay *display = NULL;
@ -439,7 +435,7 @@ _create_allocator (GstVaVp8Dec * self, GstCaps * caps, guint * size)
gst_object_unref (display);
if (!_try_allocator (self, allocator, caps, size))
if (!_try_allocator (self, allocator, caps))
gst_clear_object (&allocator);
return allocator;
@ -469,7 +465,7 @@ gst_va_vp8_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
GstStructure *config;
GstVideoInfo info;
GstVaVp8Dec *self = GST_VA_VP8_DEC (decoder);
guint size, min, max;
guint size = 0, min, max;
gboolean update_pool = FALSE, update_allocator = FALSE;
gst_query_parse_allocation (query, &caps, NULL);
@ -537,7 +533,7 @@ gst_va_vp8_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
}
if (!allocator) {
if (!(allocator = _create_allocator (self, caps, &size)))
if (!(allocator = _create_allocator (self, caps)))
return FALSE;
}

View file

@ -397,7 +397,7 @@ gst_va_vpp_set_context (GstElement * element, GstContext * context)
static gboolean
_try_allocator (GstVaVpp * self, GstAllocator * allocator, GstCaps * caps,
guint usage_hint, guint * size)
guint usage_hint)
{
GstVaAllocationParams params = {
.usage_hint = usage_hint,
@ -415,15 +415,11 @@ _try_allocator (GstVaVpp * self, GstAllocator * allocator, GstCaps * caps,
return FALSE;
}
if (size)
*size = GST_VIDEO_INFO_SIZE (&params.info);
return TRUE;
}
static GstAllocator *
_create_allocator (GstVaVpp * self, GstCaps * caps, guint usage_hint,
guint * size)
_create_allocator (GstVaVpp * self, GstCaps * caps, guint usage_hint)
{
GstAllocator *allocator = NULL;
@ -434,7 +430,7 @@ _create_allocator (GstVaVpp * self, GstCaps * caps, guint usage_hint,
allocator = gst_va_allocator_new (self->display, surface_formats);
}
if (!_try_allocator (self, allocator, caps, usage_hint, size))
if (!_try_allocator (self, allocator, caps, usage_hint))
gst_clear_object (&allocator);
return allocator;
@ -508,7 +504,7 @@ gst_va_vpp_propose_allocation (GstBaseTransform * trans,
}
if (!allocator) {
if (!(allocator = _create_allocator (self, caps, usage_hint, &size)))
if (!(allocator = _create_allocator (self, caps, usage_hint)))
return FALSE;
}
@ -558,7 +554,7 @@ gst_va_vpp_decide_allocation (GstBaseTransform * trans, GstQuery * query)
GstBufferPool *pool = NULL;
GstCaps *outcaps = NULL;
GstStructure *config;
guint min, max, size, usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE;
guint min, max, size = 0, usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE;
gboolean update_pool, update_allocator;
gst_query_parse_allocation (query, &outcaps, NULL);
@ -593,7 +589,7 @@ gst_va_vpp_decide_allocation (GstBaseTransform * trans, GstQuery * query)
}
if (!allocator) {
if (!(allocator = _create_allocator (self, outcaps, usage_hint, &size)))
if (!(allocator = _create_allocator (self, outcaps, usage_hint)))
return FALSE;
}
@ -983,7 +979,7 @@ _get_sinkpad_pool (GstVaVpp * self)
size = GST_VIDEO_INFO_SIZE (&self->in_info);
allocator = _create_allocator (self, self->incaps, usage_hint, &size);
allocator = _create_allocator (self, self->incaps, usage_hint);
self->sinkpad_pool = _create_sinkpad_bufferpool (self->incaps, size, 0, 0,
usage_hint, allocator, &params);