summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2023-04-04 21:40:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-04-04 21:40:09 +0000
commite4258d9fd447293764eb0eea16e50d0a9696545b (patch)
treea8704432184c106d656b1f280fcb730078f4b8c9
parent55a1d27a9f452309f36db8643a214231548ae48a (diff)
parent747be7e691945671a0bb1e2f4c9278c036cb34e3 (diff)
downloadav-e4258d9fd447293764eb0eea16e50d0a9696545b.tar.gz
-rw-r--r--services/camera/libcameraservice/device3/Camera3OutputUtils.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp b/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp
index 792756ab61..5021f297c8 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp
@@ -537,9 +537,24 @@ void processCaptureResult(CaptureOutputStates& states, const camera_capture_resu
if (deviceInfo != states.physicalDeviceInfoMap.end()) {
auto orientation = deviceInfo->second.find(ANDROID_SENSOR_ORIENTATION);
if (orientation.count > 0) {
+ int32_t transform;
ret = CameraUtils::getRotationTransform(deviceInfo->second,
- OutputConfiguration::MIRROR_MODE_AUTO, &request.transform);
- if (ret != OK) {
+ OutputConfiguration::MIRROR_MODE_AUTO, &transform);
+ if (ret == OK) {
+ // It is possible for camera providers to return the capture
+ // results after the processed frames. In such scenario, we will
+ // not be able to set the output transformation before the frames
+ // return back to the consumer for the current capture request
+ // but we could still try and configure it for any future requests
+ // that are still in flight. The assumption is that the physical
+ // device id remains the same for the duration of the pending queue.
+ for (size_t i = 0; i < states.inflightMap.size(); i++) {
+ auto &r = states.inflightMap.editValueAt(i);
+ if (r.requestTimeNs >= request.requestTimeNs) {
+ r.transform = transform;
+ }
+ }
+ } else {
ALOGE("%s: Failed to calculate current stream transformation: %s "
"(%d)", __FUNCTION__, strerror(-ret), ret);
}