From a5cb888578661421e068e0e47f6848560ae07e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 8 Aug 2025 12:10:37 +0200 Subject: [PATCH] spa: libcamera: source: freeBuffers(): split pending request removal `freeBuffers()` should undo exactly what `allocBuffers()` does. However, it currently also clears `impl::pendingRequests`, but that is filled by `spa_libcamera_buffer_recycle()` during `spa_libcamera_alloc_buffers()`. So remove the clearing of `impl::pendingRequests` from `freeBuffers()` and move it directly into `spa_libcamera_clear_buffers()`. (cherry picked from commit 89545946fd95ce01a7ba64d42d0be0d158a84e4b) --- spa/plugins/libcamera/libcamera-source.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index c0ee51860..3d1c7c5a0 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -322,7 +322,6 @@ int allocBuffers(struct impl *impl, struct port *port, unsigned int count) void freeBuffers(struct impl *impl, struct port *port) { - impl->pendingRequests.clear(); impl->requestPool.clear(); impl->allocator->free(port->streamConfig.stream()); } @@ -353,6 +352,7 @@ int spa_libcamera_clear_buffers(struct impl *impl, struct port *port) d[0].type = SPA_ID_INVALID; } + impl->pendingRequests.clear(); freeBuffers(impl, port); port->n_buffers = 0; port->ring = SPA_RINGBUFFER_INIT();