summaryrefslogtreecommitdiff
path: root/src/ipa/rpi/controller
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-06-07 11:00:54 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-06-07 20:39:32 +0100
commit0ee9339331c648232e87d2de2ccd5a92cc61cab2 (patch)
tree82eced77c0a982fb57c9b155dbad082e273e2d7a /src/ipa/rpi/controller
parent5242b78c0bfa2ea2849fb428ca8ece2ffb83f9fe (diff)
ipa: rpi: agc: Gracefully handle missing agc modes
If a metering/exposure/constraint mode is not listed in the sensor tuning file, and a control for the missing mode is set on the agc, we terminate the application with a fatal log message. Instead of this fatal termination, log a warning message and switch to the appropriate default mode so that the application continues running. Bug: https://github.com/raspberrypi/libcamera/issues/59 Bug: https://github.com/ayufan/camera-streamer/issues/67 Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/rpi/controller')
-rw-r--r--src/ipa/rpi/controller/rpi/agc.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/ipa/rpi/controller/rpi/agc.cpp b/src/ipa/rpi/controller/rpi/agc.cpp
index b611157a..e60ca33f 100644
--- a/src/ipa/rpi/controller/rpi/agc.cpp
+++ b/src/ipa/rpi/controller/rpi/agc.cpp
@@ -540,24 +540,39 @@ void Agc::housekeepConfig()
*/
if (meteringModeName_ != status_.meteringMode) {
auto it = config_.meteringModes.find(meteringModeName_);
- if (it == config_.meteringModes.end())
- LOG(RPiAgc, Fatal) << "No metering mode " << meteringModeName_;
- meteringMode_ = &it->second;
+ if (it == config_.meteringModes.end()) {
+ LOG(RPiAgc, Warning) << "No metering mode " << meteringModeName_
+ << ", defaulting to " << config_.defaultMeteringMode;
+ meteringModeName_ = config_.defaultMeteringMode;
+ meteringMode_ = &config_.meteringModes[meteringModeName_];
+ } else {
+ meteringMode_ = &it->second;
+ }
status_.meteringMode = meteringModeName_;
}
if (exposureModeName_ != status_.exposureMode) {
auto it = config_.exposureModes.find(exposureModeName_);
- if (it == config_.exposureModes.end())
- LOG(RPiAgc, Fatal) << "No exposure profile " << exposureModeName_;
- exposureMode_ = &it->second;
+ if (it == config_.exposureModes.end()) {
+ LOG(RPiAgc, Warning) << "No exposure profile " << exposureModeName_
+ << ", defaulting to " << config_.defaultExposureMode;
+ exposureModeName_ = config_.defaultExposureMode;
+ exposureMode_ = &config_.exposureModes[exposureModeName_];
+ } else {
+ exposureMode_ = &it->second;
+ }
status_.exposureMode = exposureModeName_;
}
if (constraintModeName_ != status_.constraintMode) {
auto it =
config_.constraintModes.find(constraintModeName_);
- if (it == config_.constraintModes.end())
- LOG(RPiAgc, Fatal) << "No constraint list " << constraintModeName_;
- constraintMode_ = &it->second;
+ if (it == config_.constraintModes.end()) {
+ LOG(RPiAgc, Warning) << "No constraint list " << constraintModeName_
+ << ", defaulting to " << config_.defaultConstraintMode;
+ constraintModeName_ = config_.defaultConstraintMode;
+ constraintMode_ = &config_.constraintModes[constraintModeName_];
+ } else {
+ constraintMode_ = &it->second;
+ }
status_.constraintMode = constraintModeName_;
}
LOG(RPiAgc, Debug) << "exposureMode "