[0/4] gstreamer: Miscellaneous cleanups + one fix
mbox series

Message ID 20250522125521.6465-1-laurent.pinchart@ideasonboard.com
Headers show
Series
  • gstreamer: Miscellaneous cleanups + one fix
Related show

Message

Laurent Pinchart May 22, 2025, 12:55 p.m. UTC
Hello everybody,

Here's a set of miscellaneous cleanups for libcamerasrc that follow the
recently added GstVideoMeta support. They mostly improve readability,
but patch 3/4 also fixes a leak.

The refactoring in patch 4/4 makes explicit that the
gst_libcamera_create_video_pool() function can return a NULL video pool
in two cases. I have not marked them as error to avoid changing the
current behaviour. Feedback from people more knowledgeable than me about
GStreamer would be appreciated to tell if this is correct, or if we need
an additional patch to turn those paths into errors.

The code has been compile-tested only as I'm not sure how to exercize
the video pool creation code path.

Laurent Pinchart (4):
  gstreamer: Document improvements when updating minimum GStreamer
    version
  gstreamer: Factor out video pool creation
  gstreamer: Fix leak of GstQuery in error path
  gstreamer: Reduce indentation in gst_libcamera_create_video_pool()

 src/gstreamer/gstlibcamerasrc.cpp | 118 ++++++++++++++++++------------
 1 file changed, 71 insertions(+), 47 deletions(-)


base-commit: efdbe3969841e342c30dfdced38b6ad9ad55dccf
--
Regards,

Laurent Pinchart

Comments

Nicolas Dufresne May 22, 2025, 5:18 p.m. UTC | #1
Hi,

Le jeudi 22 mai 2025 à 14:55 +0200, Laurent Pinchart a écrit :
> Hello everybody,
> 
> Here's a set of miscellaneous cleanups for libcamerasrc that follow the
> recently added GstVideoMeta support. They mostly improve readability,
> but patch 3/4 also fixes a leak.
> 
> The refactoring in patch 4/4 makes explicit that the
> gst_libcamera_create_video_pool() function can return a NULL video pool
> in two cases. I have not marked them as error to avoid changing the
> current behaviour. Feedback from people more knowledgeable than me about
> GStreamer would be appreciated to tell if this is correct, or if we need
> an additional patch to turn those paths into errors.
> 
> The code has been compile-tested only as I'm not sure how to exercize
> the video pool creation code path.

Its a bit tricky, since its only created if you have no stride support in
your pipeline. This can be simulated:

  gst-launch-1.0 libcamerasrc ! identity drop-allocation=1 ! fakevideosink

And you also need the camera driver to produce a padded stride (a stride not
strictly derived from the width and pixel format). You are more likely then me
to have access to such hardware. Its a good opportunity to improve vimc of
course.

regards,
Nicolas

> 
> Laurent Pinchart (4):
>   gstreamer: Document improvements when updating minimum GStreamer
>     version
>   gstreamer: Factor out video pool creation
>   gstreamer: Fix leak of GstQuery in error path
>   gstreamer: Reduce indentation in gst_libcamera_create_video_pool()
> 
>  src/gstreamer/gstlibcamerasrc.cpp | 118 ++++++++++++++++++------------
>  1 file changed, 71 insertions(+), 47 deletions(-)
> 
> 
> base-commit: efdbe3969841e342c30dfdced38b6ad9ad55dccf
> --
> Regards,
> 
> Laurent Pinchart