[gtk/4.0-backports: 11/53] gtkgstsink: Report allocation size even if no pool requested
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/4.0-backports: 11/53] gtkgstsink: Report allocation size even if no pool requested
- Date: Sun, 7 Feb 2021 17:49:40 +0000 (UTC)
commit 949fb8a8faaf274698f963ccc763f16775e3f55b
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date: Mon Jan 25 22:39:32 2021 +0100
gtkgstsink: Report allocation size even if no pool requested
We can do that so we should.
modules/media/gtkgstsink.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/modules/media/gtkgstsink.c b/modules/media/gtkgstsink.c
index 1fb6719ee4..7375525c60 100644
--- a/modules/media/gtkgstsink.c
+++ b/modules/media/gtkgstsink.c
@@ -172,6 +172,7 @@ gtk_gst_sink_propose_allocation (GstBaseSink *bsink,
GstCaps *caps;
guint size;
gboolean need_pool;
+ GstVideoInfo info;
if (!self->gst_context)
return FALSE;
@@ -187,22 +188,20 @@ gtk_gst_sink_propose_allocation (GstBaseSink *bsink,
if (!gst_caps_features_contains (gst_caps_get_features (caps, 0), GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
return FALSE;
- if (need_pool)
+ if (!gst_video_info_from_caps (&info, caps))
{
- GstVideoInfo info;
+ GST_DEBUG_OBJECT (self, "invalid caps specified");
+ return FALSE;
+ }
- if (!gst_video_info_from_caps (&info, caps))
- {
- GST_DEBUG_OBJECT (self, "invalid caps specified");
- return FALSE;
- }
+ /* the normal size of a frame */
+ size = info.size;
+ if (need_pool)
+ {
GST_DEBUG_OBJECT (self, "create new pool");
pool = gst_gl_buffer_pool_new (self->gst_context);
- /* the normal size of a frame */
- size = info.size;
-
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
@@ -212,12 +211,13 @@ gtk_gst_sink_propose_allocation (GstBaseSink *bsink,
gst_object_unref (pool);
return FALSE;
}
-
- /* we need at least 2 buffer because we hold on to the last one */
- gst_query_add_allocation_pool (query, pool, size, 2, 0);
- gst_object_unref (pool);
}
+ /* we need at least 2 buffer because we hold on to the last one */
+ gst_query_add_allocation_pool (query, pool, size, 2, 0);
+ if (pool)
+ gst_object_unref (pool);
+
/* we also support various metadata */
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]