From 64eb0f0ed27324968655c29e14a06b3e4049b657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 7 Oct 2020 12:49:44 +0200 Subject: [PATCH] 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: --- sys/va/gstvah264dec.c | 14 +++++--------- sys/va/gstvavp8dec.c | 14 +++++--------- sys/va/gstvavpp.c | 18 +++++++----------- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/sys/va/gstvah264dec.c b/sys/va/gstvah264dec.c index 96e7a54a1f..88b7a9dc5f 100644 --- a/sys/va/gstvah264dec.c +++ b/sys/va/gstvah264dec.c @@ -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 (¶ms.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; } diff --git a/sys/va/gstvavp8dec.c b/sys/va/gstvavp8dec.c index 4661a184e3..e9f2d4033e 100644 --- a/sys/va/gstvavp8dec.c +++ b/sys/va/gstvavp8dec.c @@ -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 (¶ms.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; } diff --git a/sys/va/gstvavpp.c b/sys/va/gstvavpp.c index b1301b7655..e26762bb8d 100644 --- a/sys/va/gstvavpp.c +++ b/sys/va/gstvavpp.c @@ -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 (¶ms.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, ¶ms);