From fd6e41b9fb32b54f6811898f824fe50b918d82eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= <pobrn@protonmail.com>
Date: Mon, 6 Jan 2025 10:06:16 +0000
Subject: gstreamer: allocator: gst_libcamera_allocator_new(): Recognize errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

`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>
---
 src/gstreamer/gstlibcameraallocator.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/gstreamer')

diff --git a/src/gstreamer/gstlibcameraallocator.cpp b/src/gstreamer/gstlibcameraallocator.cpp
index 7e4c904d..b0c84893 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();
-- 
cgit v1.2.1