Restore frame processor after videos (#344)

pull/337/head
Mattia Iavarone 6 years ago committed by GitHub
parent 4d654f649d
commit 68e7631d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/IntegrationTest.java
  2. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java

@ -626,5 +626,19 @@ public class IntegrationTest extends BaseTest {
assert30Frames(processor);
}
@Test
public void testFrameProcessing_afterVideo() throws Exception {
FrameProcessor processor = mock(FrameProcessor.class);
camera.addFrameProcessor(processor);
camera.setSessionType(SessionType.VIDEO);
waitForOpen(true);
camera.startCapturingVideo(null, 2000);
waitForVideoEnd(true);
assert30Frames(processor);
}
//endregion
}

@ -684,6 +684,10 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
mCameraCallbacks.dispatchOnVideoTaken(mVideoFile);
mVideoFile = null;
}
if (mCamera != null) {
// This is needed to restore FrameProcessor. No re-allocation needed though.
mCamera.setPreviewCallbackWithBuffer(this);
}
}
@WorkerThread

Loading…
Cancel
Save