From 85dc1a05d44a342306d81af96b5f35d191613385 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Tue, 31 Oct 2017 13:35:49 +0100 Subject: [PATCH] Release PreviewCallback (#86) --- ISSUE_TEMPLATE.md | 10 +++++----- .../java/com/otaliastudios/cameraview/Camera1.java | 2 ++ .../java/com/otaliastudios/cameraview/CameraView.java | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 38718133..25801d86 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -7,19 +7,19 @@ Prerequisites:* - [ ] *I can reproduce the bug in the demo app, and if not...* - [ ] *I have tried to reproduce the bug in the demo app* -##### Detailed steps to reproduce the issue: +#### Detailed steps to reproduce the issue: 1. 2. 3. -##### Expected behavior: +#### Expected behavior: -##### Actual behavior: +#### Actual behavior: -##### Screenshots: +#### Screenshots: -##### Interesting logs: +#### Interesting logs: *You can use `CameraLogger.setLogLevel(LEVEL_VERBOSE)` to add logs to logcat, and `CameraLogger.registerLogger()` diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java b/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java index a55805e5..50620430 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java @@ -196,12 +196,14 @@ class Camera1 extends CameraController implements Camera.PreviewCallback { LOG.i("onStop:", "About to clean up."); mHandler.get().removeCallbacks(mPostFocusResetRunnable); if (mCamera != null) { + LOG.i("onStop:", "Clean up.", "Ending video?", mIsCapturingVideo); if (mIsCapturingVideo) endVideo(); try { LOG.i("onStop:", "Clean up.", "Stopping preview."); mCamera.stopPreview(); + mCamera.setPreviewCallback(null); LOG.i("onStop:", "Clean up.", "Stopped preview."); } catch (Exception e) { LOG.w("onStop:", "Clean up.", "Exception while stopping preview."); diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java index 8172e6d9..6c31364c 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java @@ -1607,8 +1607,8 @@ public class CameraView extends FrameLayout { @Override public void dispatchFrame(final byte[] frame, final long time, final int rotation, final Size size, final int previewFormat) { - mLogger.i("dispatchFrame", time, rotation, "processors:", mFrameProcessors.size()); if (mFrameProcessors.isEmpty()) return; + mLogger.v("dispatchFrame", time, rotation, "processors:", mFrameProcessors.size()); if (mFrame == null) mFrame = new Frame(); mFrameProcessorsHandler.post(new Runnable() { @Override