[v2,6/7] gstreamer: Drop incorrect unref on caps
diff mbox series

Message ID 20250604130741.9228-7-laurent.pinchart@ideasonboard.com
State New
Headers show
Series
  • gstreamer: Miscellaneous cleanups + two fixes
Related show

Commit Message

Laurent Pinchart June 4, 2025, 1:07 p.m. UTC
The caps object passeed to the gst_libcamera_create_video_pool()
function is managed as a g_autoptr() in the caller. The function doesn't
acquire any new reference, so it shouldn't call gst_caps_unref(). Fix
it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
I believe this is right (or I wouldn't send it), but a confirmation that
nothing in gst_libcamera_create_video_pool() acquires a reference to the
caps would be appreciated.
---
 src/gstreamer/gstlibcamerasrc.cpp | 1 -
 1 file changed, 1 deletion(-)

Comments

Nicolas Dufresne June 4, 2025, 5:13 p.m. UTC | #1
Le mercredi 04 juin 2025 à 16:07 +0300, Laurent Pinchart a écrit :
> The caps object passeed to the gst_libcamera_create_video_pool()
> function is managed as a g_autoptr() in the caller. The function doesn't
> acquire any new reference, so it shouldn't call gst_caps_unref(). Fix
> it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
> I believe this is right (or I wouldn't send it), but a confirmation that
> nothing in gst_libcamera_create_video_pool() acquires a reference to the
> caps would be appreciated.
> ---
>  src/gstreamer/gstlibcamerasrc.cpp | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
> index 0be64dd836ca..eec8163e88e7 100644
> --- a/src/gstreamer/gstlibcamerasrc.cpp
> +++ b/src/gstreamer/gstlibcamerasrc.cpp
> @@ -580,7 +580,6 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,
>  	}
>  
>  	if (!gst_buffer_pool_set_active(pool, true)) {
> -		gst_caps_unref(caps);
>  		GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,
>  				  ("Failed to active buffer pool"),
>  				  ("gst_libcamera_src_negotiate() failed."));

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index 0be64dd836ca..eec8163e88e7 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -580,7 +580,6 @@  gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,
 	}
 
 	if (!gst_buffer_pool_set_active(pool, true)) {
-		gst_caps_unref(caps);
 		GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,
 				  ("Failed to active buffer pool"),
 				  ("gst_libcamera_src_negotiate() failed."));