diff options
Diffstat (limited to 'tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java')
-rw-r--r-- | tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java b/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java index b0aae411f29..db2b61627b7 100644 --- a/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java +++ b/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java @@ -127,6 +127,7 @@ public class BurstCaptureTest extends Camera2SurfaceViewTestCase { // Create session and start up preview SimpleCaptureCallback resultListener = new SimpleCaptureCallback(); + SimpleCaptureCallback burstResultListener = new SimpleCaptureCallback(); ImageDropperListener imageDropper = new ImageDropperListener(); prepareCaptureAndStartPreview( @@ -214,7 +215,7 @@ public class BurstCaptureTest extends Camera2SurfaceViewTestCase { if (maxSyncLatency == CameraCharacteristics.SYNC_MAX_LATENCY_PER_FRAME_CONTROL) { // The locked result we have is already synchronized so start the burst - mSession.captureBurst(burst, resultListener, mHandler); + mSession.captureBurst(burst, burstResultListener, mHandler); } else { // Need to get a synchronized result, and may need to start burst later to // be synchronized correctly @@ -232,7 +233,7 @@ public class BurstCaptureTest extends Camera2SurfaceViewTestCase { int requestsNeededToSync = numFramesWaited - pipelineDepth; for (int i = 0; i < numFramesWaited; i++) { if (!burstSent && requestsNeededToSync <= 0) { - mSession.captureBurst(burst, resultListener, mHandler); + mSession.captureBurst(burst, burstResultListener, mHandler); burstSent = true; } lockedResult = resultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS); @@ -270,12 +271,14 @@ public class BurstCaptureTest extends Camera2SurfaceViewTestCase { // Process burst results int burstIndex = 0; CaptureResult burstResult = - resultListener.getCaptureResultForRequest(burst.get(burstIndex), - maxPipelineDepth + 1); + burstResultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS); long prevTimestamp = -1; final long frameDurationBound = (long) (minStillFrameDuration * (1 + FRAME_DURATION_MARGIN_FRACTION) ); + long burstStartTimestamp = burstResult.get(CaptureResult.SENSOR_TIMESTAMP); + long burstEndTimeStamp = 0; + List<Long> frameDurations = new ArrayList<>(); while(true) { @@ -307,8 +310,25 @@ public class BurstCaptureTest extends Camera2SurfaceViewTestCase { // Get next result burstIndex++; - if (burstIndex == BURST_SIZE) break; - burstResult = resultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS); + if (burstIndex == BURST_SIZE) { + burstEndTimeStamp = burstResult.get(CaptureResult.SENSOR_TIMESTAMP); + break; + } + burstResult = burstResultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS); + } + + // Verify no preview frames interleaved in burst results + while (true) { + CaptureResult previewResult = + resultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS); + long previewTimestamp = previewResult.get(CaptureResult.SENSOR_TIMESTAMP); + if (previewTimestamp >= burstStartTimestamp && previewTimestamp <= burstEndTimeStamp) { + fail("Preview frame is interleaved with burst frames! Preview timestamp:" + + previewTimestamp + ", burst [" + burstStartTimestamp + ", " + + burstEndTimeStamp + "]"); + } else if (previewTimestamp > burstEndTimeStamp) { + break; + } } // Verify inter-frame durations |