Camera: Combine handling of deferred surface and shared surface
- Refactor the OutputConfiguration to contain isDeferred and isShared
flag, and not contain NULL surface.
- Unify the handling of deferred surface and shared surface.
Test: Camera CTS, and manual testing of GoogleCamera use cases
Bug: 33777818
Change-Id: I5dd3472f0f2133699b0e9fbdd8ba456956222746
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
index 1e76a27..b5883e3 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
@@ -710,14 +710,19 @@
Mutex::Autolock l(mLock);
if (surface_id != 0) {
- ALOGE("%s: surface_id for Camera3OutputStream should be 0!", __FUNCTION__);
+ ALOGE("%s: surface_id %zu for Camera3OutputStream should be 0!", __FUNCTION__, surface_id);
}
return mConsumer == nullptr;
}
-status_t Camera3OutputStream::setConsumer(sp<Surface> consumer) {
- if (consumer == nullptr) {
- ALOGE("%s: it's illegal to set a null consumer surface!", __FUNCTION__);
+status_t Camera3OutputStream::setConsumers(const std::vector<sp<Surface>>& consumers) {
+ if (consumers.size() != 1) {
+ ALOGE("%s: it's illegal to set %zu consumer surfaces!",
+ __FUNCTION__, consumers.size());
+ return INVALID_OPERATION;
+ }
+ if (consumers[0] == nullptr) {
+ ALOGE("%s: it's illegal to set null consumer surface!", __FUNCTION__);
return INVALID_OPERATION;
}
@@ -726,7 +731,7 @@
return INVALID_OPERATION;
}
- mConsumer = consumer;
+ mConsumer = consumers[0];
return OK;
}