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)
@SdkExclude(maxSdkVersion = 22, emulatorOnly = true)
public void testFrameProcessing_format() {
// Add a empty processor before opening. This makes sure that future addFrameProcessor
// calls will not trigger a restartBind() which can cause issues on legacy devices,
// since the setFrameProcessingFormat already triggers one.
camera.addFrameProcessor(new FrameProcessor() {
public void process(@NonNull Frame frame) { }
});
// We wouldn't need to open/close for each format, but we do because legacy devices can
// crash due to their bad internal implementation when we perform restartBind().
// And setFrameProcessorFormat can trigger such restart.
CameraOptions o = openSync(true);
Collection<Integer> formats = o.getSupportedFrameProcessingFormats();
closeSync(true);
for (int format : formats) {
LOG.i("[TEST FRAME FORMAT]", "Testing", format, "...");
Op<Boolean> op = testFrameProcessorFormat(format);
assertNotNull(op.await(DELAY));
closeSync(true);
}
}
@ -1163,6 +1162,7 @@ public abstract class CameraIntegrationTest<E extends CameraBaseEngine> extends
}
}
});
openSync(true);
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
// in real devices, for benefits that I'm not 100% sure about.
if (true) {
if (false) {
try {
// Preferring abortCaptures() over stopRepeating(): it makes sure that all
// in-flight operations are discarded as fast as possible, which is what we want.

Loading…
Cancel
Save