[v3,1/2] gstreamer: allocator: gst_libcamera_allocator_new(): Recognize errors
diff mbox series

Message ID 20250106100613.493108-1-pobrn@protonmail.com
State Accepted
Headers show
Series
  • [v3,1/2] gstreamer: allocator: gst_libcamera_allocator_new(): Recognize errors
Related show

Commit Message

Barnabás Pőcze Jan. 6, 2025, 10:06 a.m. UTC
`FrameBufferAllocator::allocate()` might return a negative error code,
but currently this is handled the same way as success. So instead
of continuing, abort the construction of the allocator object.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
Changes in v3: none
Changes in v2: none
---
 src/gstreamer/gstlibcameraallocator.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.47.1

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcameraallocator.cpp b/src/gstreamer/gstlibcameraallocator.cpp
index 7e4c904da..b0c84893a 100644
--- a/src/gstreamer/gstlibcameraallocator.cpp
+++ b/src/gstreamer/gstlibcameraallocator.cpp
@@ -214,7 +214,7 @@  gst_libcamera_allocator_new(std::shared_ptr<Camera> camera,
 		Stream *stream = streamCfg.stream();

 		ret = self->fb_allocator->allocate(stream);
-		if (ret == 0)
+		if (ret <= 0)
 			return nullptr;

 		GQueue *pool = g_queue_new();