summaryrefslogtreecommitdiff
path: root/src/android/camera_device.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-09-02 11:01:51 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-09-18 11:31:56 +0200
commit5b64f647458ff721c9c3269e10ed8bf7462a4ab1 (patch)
treee85522a5cb22e07f6c66cc9a7fd004aedfae2d72 /src/android/camera_device.cpp
parent4961033ac9a84fa26cbbca22c81832d34138196f (diff)
android: camera_device: Get rid of stream counter
Use the size() method of the CameraConfiguration class to retrieve the index of the StreamConfiguration associated with a CameraStream and get rid of the custom counter. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r--src/android/camera_device.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 0608d026..e2c73ff4 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1190,12 +1190,6 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
streams_.clear();
streams_.reserve(stream_list->num_streams);
- /*
- * Track actually created streams, as there may not be a 1:1 mapping of
- * camera3 streams to libcamera streams.
- */
- unsigned int streamIndex = 0;
-
/* First handle all non-MJPEG streams. */
for (unsigned int i = 0; i < stream_list->num_streams; ++i) {
camera3_stream_t *stream = stream_list->streams[i];
@@ -1226,8 +1220,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
streamConfiguration.pixelFormat = format;
config_->addConfiguration(streamConfiguration);
-
- streams_[i].index = streamIndex++;
+ streams_[i].index = config_->size() - 1;
}
/* Now handle MJPEG streams, adding a new stream if required. */
@@ -1276,7 +1269,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
<< " for MJPEG support";
config_->addConfiguration(streamConfiguration);
- streams_[i].index = streamIndex++;
+ streams_[i].index = config_->size() - 1;
}
}