summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index e8dab6f0..62291d2c 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -241,16 +241,30 @@ Camera::streamConfiguration(std::vector<Stream *> &streams)
*/
int Camera::configureStreams(std::map<Stream *, StreamConfiguration> &config)
{
+ int ret;
+
+ ret = exclusiveAccess();
+ if (ret)
+ return ret;
+
+ if (!config.size()) {
+ LOG(Camera, Error)
+ << "Can't configure streams without a configuration";
+ return -EINVAL;
+ }
+
+ return pipe_->configureStreams(this, config);
+}
+
+int Camera::exclusiveAccess()
+{
if (disconnected_)
return -ENODEV;
if (!acquired_)
return -EACCES;
- if (!config.size())
- return -EINVAL;
-
- return pipe_->configureStreams(this, config);
+ return 0;
}
} /* namespace libcamera */