Improve testFrameProcessing_format again

pull/716/head
Mattia Iavarone 6 years ago
parent deb6595db5
commit 3ee0c52634
  1. 12
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/engine/CameraIntegrationTest.java
  2. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java

@ -1135,18 +1135,17 @@ public abstract class CameraIntegrationTest<E extends CameraBaseEngine> extends
@Retry(emulatorOnly = true) @Retry(emulatorOnly = true)
@SdkExclude(maxSdkVersion = 22, emulatorOnly = true) @SdkExclude(maxSdkVersion = 22, emulatorOnly = true)
public void testFrameProcessing_format() { public void testFrameProcessing_format() {
// Add a empty processor before opening. This makes sure that future addFrameProcessor // We wouldn't need to open/close for each format, but we do because legacy devices can
// calls will not trigger a restartBind() which can cause issues on legacy devices, // crash due to their bad internal implementation when we perform restartBind().
// since the setFrameProcessingFormat already triggers one. // And setFrameProcessorFormat can trigger such restart.
camera.addFrameProcessor(new FrameProcessor() {
public void process(@NonNull Frame frame) { }
});
CameraOptions o = openSync(true); CameraOptions o = openSync(true);
Collection<Integer> formats = o.getSupportedFrameProcessingFormats(); Collection<Integer> formats = o.getSupportedFrameProcessingFormats();
closeSync(true);
for (int format : formats) { for (int format : formats) {
LOG.i("[TEST FRAME FORMAT]", "Testing", format, "..."); LOG.i("[TEST FRAME FORMAT]", "Testing", format, "...");
Op<Boolean> op = testFrameProcessorFormat(format); Op<Boolean> op = testFrameProcessorFormat(format);
assertNotNull(op.await(DELAY)); assertNotNull(op.await(DELAY));
closeSync(true);
} }
} }
@ -1163,6 +1162,7 @@ public abstract class CameraIntegrationTest<E extends CameraBaseEngine> extends
} }
} }
}); });
openSync(true);
return op; return op;
} }

@ -665,7 +665,7 @@ public class Camera2Engine extends CameraBaseEngine implements
} }
// Removing the part below for now. It hangs on emulators and can take a lot of time // Removing the part below for now. It hangs on emulators and can take a lot of time
// in real devices, for benefits that I'm not 100% sure about. // in real devices, for benefits that I'm not 100% sure about.
if (true) { if (false) {
try { try {
// Preferring abortCaptures() over stopRepeating(): it makes sure that all // Preferring abortCaptures() over stopRepeating(): it makes sure that all
// in-flight operations are discarded as fast as possible, which is what we want. // in-flight operations are discarded as fast as possible, which is what we want.

Loading…
Cancel
Save