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/Camera3StreamSplitter.cpp b/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp
index b935141..07f9491 100644
--- a/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp
+++ b/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp
@@ -55,14 +55,15 @@
// Add output surfaces. This has to be before creating internal buffer queue
// in order to get max consumer side buffers.
for (size_t i = 0; i < surfaces.size(); i++) {
- if (surfaces[i] != nullptr) {
- res = addOutputLocked(surfaces[i], hal_max_buffers,
- OutputType::NonDeferred);
- if (res != OK) {
- ALOGE("%s: Failed to add output surface: %s(%d)",
- __FUNCTION__, strerror(-res), res);
- return res;
- }
+ if (surfaces[i] == nullptr) {
+ ALOGE("%s: Fatal: surface is NULL", __FUNCTION__);
+ return BAD_VALUE;
+ }
+ res = addOutputLocked(surfaces[i], hal_max_buffers, OutputType::NonDeferred);
+ if (res != OK) {
+ ALOGE("%s: Failed to add output surface: %s(%d)",
+ __FUNCTION__, strerror(-res), res);
+ return res;
}
}
@@ -110,7 +111,7 @@
}
status_t Camera3StreamSplitter::addOutput(
- sp<Surface>& outputQueue, size_t hal_max_buffers) {
+ const sp<Surface>& outputQueue, size_t hal_max_buffers) {
Mutex::Autolock lock(mMutex);
return addOutputLocked(outputQueue, hal_max_buffers, OutputType::Deferred);
}