[libcamera-devel] [PATCH v2 02/12] gstreamer: Move variable to loop scope

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Jun 30 02:02:41 CEST 2022


The GstBuffer variable in GstLibcameraSrcState::requestCompleted() is
only used within the loop scope. Make it a local loop variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
---
 src/gstreamer/gstlibcamerasrc.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index 9d6be075a474..dea143961d69 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -165,10 +165,9 @@ GstLibcameraSrcState::requestCompleted(Request *request)
 		return;
 	}
 
-	GstBuffer *buffer;
 	for (GstPad *srcpad : srcpads_) {
 		Stream *stream = gst_libcamera_pad_get_stream(srcpad);
-		buffer = wrap->detachBuffer(stream);
+		GstBuffer *buffer = wrap->detachBuffer(stream);
 
 		FrameBuffer *fb = gst_libcamera_buffer_get_frame_buffer(buffer);
 
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list