pull/696/head
Mattia Iavarone 6 years ago
parent 74121d99b4
commit c35f206d94
  1. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera1Engine.java
  2. 3
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java
  3. 1
      cameraview/src/main/java/com/otaliastudios/cameraview/picture/Full1PictureRecorder.java
  4. 1
      cameraview/src/main/java/com/otaliastudios/cameraview/video/FullVideoRecorder.java

@ -240,15 +240,19 @@ public class Camera1Engine extends CameraEngine implements
@NonNull
@Override
protected Task<Void> onStopPreview() {
LOG.i("onStopPreview:", "Started.");
if (mVideoRecorder != null) {
mVideoRecorder.stop(true);
mVideoRecorder = null;
}
mPictureRecorder = null;
getFrameManager().release();
LOG.i("onStopPreview:", "Releasing preview buffers.");
mCamera.setPreviewCallbackWithBuffer(null); // Release anything left
try {
LOG.i("onStopPreview:", "Stopping preview.");
mCamera.stopPreview();
LOG.i("onStopPreview:", "Stopped preview.");
} catch (Exception e) {
LOG.e("stopPreview", "Could not stop preview", e);
}

@ -627,7 +627,7 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
@NonNull
@Override
protected Task<Void> onStopPreview() {
LOG.i("onStopPreview:", "About to clean up.");
LOG.i("onStopPreview:", "Started.");
if (mVideoRecorder != null) {
// This should synchronously call onVideoResult that will reset the repeating builder
// to the PREVIEW template. This is very important.
@ -643,6 +643,7 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
// are discarded as fast as possible, which is exactly what we want.
// NOTE: this call is asynchronous. Should find a good way to wait for the outcome.
LOG.i("onStopPreview:", "calling abortCaptures().");
// TODO HANGS (rare, emulator only)
mSession.abortCaptures();
LOG.i("onStopPreview:", "called abortCaptures().");
} catch (CameraAccessException e) {

@ -35,6 +35,7 @@ public class Full1PictureRecorder extends FullPictureRecorder {
@Override
public void take() {
LOG.i("take() called.");
// TODO HANGS (rare, emulator only)
mCamera.takePicture(
new Camera.ShutterCallback() {
@Override

@ -307,6 +307,7 @@ public abstract class FullVideoRecorder extends VideoRecorder {
dispatchVideoRecordingEnd();
try {
LOG.i("stop:", "Stopping MediaRecorder...");
// TODO HANGS (rare, emulator only)
mMediaRecorder.stop();
LOG.i("stop:", "Stopped MediaRecorder.");
} catch (Exception e) {

Loading…
Cancel
Save