From 91efc4ecdbc1d4ee35271ae5a65234a4c006c239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Thu, 26 May 2022 10:21:06 +0200 Subject: [PATCH] plugin: gluploader: Use GLUpload provided propose_allocation method Instead figuring out what kind of pool we should make just use the upstream provided functionality that comes as part of GLUpload API. Fixes uploads with GstVideoGLTextureUploadMeta, which legacy VAAPI plugin uses on GLX. --- .../plugin/importers/gstclappergluploader.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/gst/plugin/importers/gstclappergluploader.c b/lib/gst/plugin/importers/gstclappergluploader.c index 349d9409..3f779349 100644 --- a/lib/gst/plugin/importers/gstclappergluploader.c +++ b/lib/gst/plugin/importers/gstclappergluploader.c @@ -137,6 +137,31 @@ _upload_perform_locked (GstClapperGLUploader *self, GstBuffer *buffer) return upload_buf; } +static GstBufferPool * +gst_clapper_gl_uploader_create_pool (GstClapperImporter *importer, GstStructure **config) +{ + /* Since GLUpload API provides a ready to use propose_allocation method, + * we will use it with our query in add_allocation_metas instead of + * making pool here ourselves */ + return NULL; +} + +static void +gst_clapper_gl_uploader_add_allocation_metas (GstClapperImporter *importer, GstQuery *query) +{ + GstClapperGLUploader *self = GST_CLAPPER_GL_UPLOADER_CAST (importer); + GstGLUpload *upload; + + GST_CLAPPER_GL_BASE_IMPORTER_LOCK (self); + upload = gst_object_ref (self->upload); + GST_CLAPPER_GL_BASE_IMPORTER_UNLOCK (self); + + gst_gl_upload_propose_allocation (upload, NULL, query); + gst_object_unref (upload); + + GST_CLAPPER_IMPORTER_CLASS (parent_class)->add_allocation_metas (importer, query); +} + static GdkTexture * gst_clapper_gl_uploader_generate_texture (GstClapperImporter *importer, GstBuffer *buffer, GstVideoInfo *v_info) @@ -218,6 +243,8 @@ gst_clapper_gl_uploader_class_init (GstClapperGLUploaderClass *klass) importer_class->prepare = gst_clapper_gl_uploader_prepare; importer_class->set_caps = gst_clapper_gl_uploader_set_caps; + importer_class->create_pool = gst_clapper_gl_uploader_create_pool; + importer_class->add_allocation_metas = gst_clapper_gl_uploader_add_allocation_metas; importer_class->generate_texture = gst_clapper_gl_uploader_generate_texture; }