summaryrefslogtreecommitdiff
path: root/src/android/camera_device.cpp
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2021-04-02 11:12:37 +0900
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-04-20 05:55:50 +0300
commit0b661d70ec62d69ffd4ea7bb0aeb92d7ad12b8d3 (patch)
treed62d0c83f8ef150f2d00769801ff45544fd2f1f8 /src/android/camera_device.cpp
parent796109c8dcb133d85a30f12864d924b20dad5f5a (diff)
android: CameraDevice: Add stop()
This adds CameraDevice::stop(), which cleans up the member variables of CameraDevice. It is called in CameraDevice::close() and CameraDevice::configureStreams(). Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r--src/android/camera_device.cpp19
1 files changed, 12 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";