diff --git a/cameraview/src/androidTest/java/com/otaliastudios/cameraview/IntegrationTest.java b/cameraview/src/androidTest/java/com/otaliastudios/cameraview/IntegrationTest.java index 4e42ce62..887bc85d 100644 --- a/cameraview/src/androidTest/java/com/otaliastudios/cameraview/IntegrationTest.java +++ b/cameraview/src/androidTest/java/com/otaliastudios/cameraview/IntegrationTest.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 } diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java b/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java index a814e7a8..b8af16b2 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java @@ -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