summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/camera_device.cpp19
-rw-r--r--src/android/camera_device.h2
2 files changed, 14 insertions, 7 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 89044efa..00eb76b5 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -754,9 +754,18 @@ void CameraDevice::close()
{
streams_.clear();
+ stop();
+
+ camera_->release();
+}
+
+void CameraDevice::stop()
+{
+ if (!running_)
+ return;
+
worker_.stop();
camera_->stop();
- camera_->release();
running_ = false;
}
@@ -1642,12 +1651,8 @@ PixelFormat CameraDevice::toPixelFormat(int format) const
*/
int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
{
- /* Before any configuration attempt, stop the camera if it's running. */
- if (running_) {
- worker_.stop();
- camera_->stop();
- running_ = false;
- }
+ /* Before any configuration attempt, stop the camera. */
+ stop();
if (stream_list->num_streams == 0) {
LOG(HAL, Error) << "No streams in configuration";
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 11bdfec8..39cf95ad 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -85,6 +85,8 @@ private:
int androidFormat;
};
+ void stop();
+
int initializeStreamConfigurations();
std::vector<libcamera::Size>
getYUVResolutions(libcamera::CameraConfiguration *cameraConfig,