diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-01-19 17:37:02 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-01-19 17:40:45 +0300 |
commit | 711313c4c57af5df06bcc9276c17321c42957524 (patch) | |
tree | 0a40dd1822588efd80c61355e03ae0895b6eee24 /video | |
parent | c83f48f0a1e5c6c56f13246759c206dd289f56a6 (diff) |
gtk4: Only provide a buffer pool to upstream if it requested one
Diffstat (limited to 'video')
-rw-r--r-- | video/gtk4/src/sink/imp.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index e975953de..4c59fbb8c 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -350,10 +350,8 @@ impl BaseSinkImpl for PaintableSink { .map_err(|_| gst::loggable_error!(CAT, "Failed to get VideoInfo from caps"))?; let size = info.size() as u32; - - let buffer_pool = gst_gl::GLBufferPool::new(&gst_context); - - if need_pool { + let buffer_pool = if need_pool { + let buffer_pool = gst_gl::GLBufferPool::new(&gst_context); gst::debug!(CAT, imp: self, "Creating new Pool"); let mut config = buffer_pool.config(); @@ -366,10 +364,14 @@ impl BaseSinkImpl for PaintableSink { format!("Failed to set config in the GL BufferPool.: {}", err) )); } - } + + Some(buffer_pool) + } else { + None + }; // we need at least 2 buffer because we hold on to the last one - query.add_allocation_pool(Some(&buffer_pool), size, 2, 0); + query.add_allocation_pool(buffer_pool.as_ref(), size, 2, 0); if gst_context.check_feature("GL_ARB_sync") || gst_context.check_feature("GL_EXT_EGL_sync") |