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

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

Commit Message

Barnabás Pőcze Dec. 16, 2024, 10:47 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>
---
 src/gstreamer/gstlibcameraallocator.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart Dec. 16, 2024, 11:25 a.m. UTC | #1
Hi Barnabás,

Thank you for the patch.

On Mon, Dec 16, 2024 at 10:47:07AM +0000, Barnabás Pőcze wrote:
> `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>

I think you missed my R-b tag from v1.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/gstreamer/gstlibcameraallocator.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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();
Nicolas Dufresne Dec. 17, 2024, 6:31 p.m. UTC | #2
Le lundi 16 décembre 2024 à 10:47 +0000, Barnabás Pőcze a écrit :
> `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: Nicolas Dufresne <nicolas.dufresne@collabora.com>

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

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();