[libcamera-devel] [PATCH v4 4/9] android: camera_device: Clear allocator
Jacopo Mondi
jacopo at jmondi.org
Wed Sep 30 15:27:02 CEST 2020
Clear all the allocated buffers at camera close() time and before
configuring the camera streams at configureStream() time as the
configureStream operation could be called by the Android framework
in two successive capture sessions without going through a close().
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh at chromium.org>
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/android/camera_device.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index d8587647f831..d73d10d9d449 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -534,6 +534,8 @@ int CameraDevice::open(const hw_module_t *hardwareModule)
void CameraDevice::close()
{
+ allocator_.freeAll();
+
camera_->stop();
camera_->release();
@@ -1181,12 +1183,13 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
}
/*
- * Clear and remove any existing configuration from previous calls, and
- * ensure the required entries are available without further
- * reallocation.
+ * Clear and remove any existing configuration and memory allocated from
+ * previous calls, and ensure the required entries are available without
+ * further reallocation.
*/
streams_.clear();
streams_.reserve(stream_list->num_streams);
+ allocator_.freeAll();
/* First handle all non-MJPEG streams. */
camera3_stream_t *jpegStream = nullptr;
--
2.28.0
More information about the libcamera-devel
mailing list