spa_libcamera_buffer_recycle sometimes fails, causing stream to freeze on first frame
The libcamera plugin sometimes throws the errors like:
ERROR Request request.cpp:472 FrameBuffer already set for stream
spa.libcamera | [libcamera-utils.: 78 spa_libcamera_buffer_recycle()] can't add buffer 1 for request: File exists
ERROR Request request.cpp:472 FrameBuffer already set for stream
spa.libcamera | [libcamera-utils.: 78 spa_libcamera_buffer_recycle()] can't add buffer 2 for request: File exists
which is then followed by the camera stream staying frozen, usually on the first frame. So far this was mainly observed when libcamera with software ISP was used, such as on postmarketOS on QCom devices, and usually after the camera ran previously and was stopped again.
Closing the app, restarting Pipewire and starting the app again usually works around the issue.
I haven't digged deep yet, but I suspect there to be some kind of "leak" where allocated dmabufs are not freed properly on stream stop, potentially because the client didn't release all buffers in time or so.
cc: @jwrdegoede, @kbingham