[libcamera-devel] [PATCH v2 00/12] gstreamer: Queue multiple requests

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


Hello,

This patch series fixes a long-standing issue in the libcamerasrc
element, namely the fact that it never queues more than one request at a
time.

Many thanks to Nicolas and Umang for reviewing v1. This version takes
all review comments into account, save for the inverted logic in patch
12/12 as the result didn't seem to me that it would match what Nicolas
intended.

It took me quite a while to grasp the implementation of libcamerasrc,
and this probably shows through the patch series. I don't claim any of
this is particularly great, only that it enables libcamerasrc usage with
rkisp1 and vimc, which isn't possible today, and that it didn't
introduce any regression I could notice.

I've also performed additional performance testing. With a sensor frame
rate of 30fps, the libcamerasrc task runs ~80 times / second, is resumed
~55 times / second, and paused ~26 times / second. This can most likely
be improved by peeking into the available buffer pools to avoid running
the task another time if not enough buffers are available to queue a
request, but I don't know if it's worth it. In any case, I believe
improvements can be made incrementally.

Nicolas, only patches 04/12, 06/12 and 12/12 are missing a review from
you.  I would be very grateful for your help there.

Please see individual patches for changes compared to v1.

Laurent Pinchart (12):
  gstreamer: Use gst_task_resume() when available
  gstreamer: Move variable to loop scope
  gstreamer: Pass Stream to RequestWrap::addBuffer()
  gstreamer: Move timestamp calculation out of pad loop
  gstreamer: Rename queued requests queue to queuedRequests_
  gstreamer: Handle completed requests in the libcamerasrc task
  gstreamer: Combine the two pad loops in the task run handler
  gstreamer: Use dedicated lock for request queues
  gstreamer: Fix pads locking
  gstreamer: Split request creation to a separate function
  gstreamer: Split completed request processing to a separate function
  gstreamer: Fix race conditions in task pause/resume

 src/gstreamer/gstlibcamera-utils.cpp |  16 +-
 src/gstreamer/gstlibcamera-utils.h   |   4 +-
 src/gstreamer/gstlibcamerapad.cpp    |  35 ---
 src/gstreamer/gstlibcamerapad.h      |   6 -
 src/gstreamer/gstlibcamerapool.cpp   |   7 -
 src/gstreamer/gstlibcamerapool.h     |   2 -
 src/gstreamer/gstlibcamerasrc.cpp    | 322 +++++++++++++++++++--------
 7 files changed, 238 insertions(+), 154 deletions(-)


base-commit: 3fa79cc688b540e27f954f156b5ad4bb172ba222
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list