Camera: Switch the reader callback when the sequence ends

Depending on timing the first captured buffer from an internal
repeating request can be incorrectly propagated to the client
preview surface. This can happen, if the first 'onCaptureStarted'
callback gets delayed and executes after the first buffer from the
internal request gets queued in the camera preview output surface.
Proactively switch the camera preview output image reader callback
to loopback after the current capture sequence ends.

Bug: 179450326
Test: Camera CTS
Change-Id: I8232ea5171a0205da5705b6af5fdd3cdab297335
This commit is contained in:
Emilian Peev
2021-02-11 15:43:03 -08:00
parent f131f0bfd2
commit 725bd108a7

View File

@@ -1233,6 +1233,8 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
int sequenceId) {
synchronized (mInterfaceLock) {
if (mInternalRepeatingRequestEnabled) {
mRepeatingRequestImageReader.setOnImageAvailableListener(
new ImageLoopbackCallback(), mHandler);
resumeInternalRepeatingRequest(true);
}
}
@@ -1263,7 +1265,12 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
mRequestUpdatedNeeded = false;
resumeInternalRepeatingRequest(false);
} else if (mInternalRepeatingRequestEnabled) {
mRepeatingRequestImageReader.setOnImageAvailableListener(
new ImageLoopbackCallback(), mHandler);
resumeInternalRepeatingRequest(true);
} else {
mRepeatingRequestImageReader.setOnImageAvailableListener(
new ImageLoopbackCallback(), mHandler);
}
}