Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application Will Crash When Taking Multiple Photos One After Another #8

Open
vigen-b opened this issue Apr 14, 2020 · 0 comments
Open

Comments

@vigen-b
Copy link

vigen-b commented Apr 14, 2020

Android system will throw error if yo try to take picture after stopPreview(). To decide take or don't take picture you are using mIsCapturing boolean which you change without synchronization with startPreview and stopPreview (see onShutter callback). This will throw error if you try to take picture multiple times one after another without short pause.

private Camera.ShutterCallback onShutterCallback = new Camera.ShutterCallback() {
@Override
public void onShutter() {
if (mIsCapturing && !mIsDuringExposure) {
mIsDuringExposure = true;
mIsCapturing = false;
/*
* Hold the current value of the attitude sensor
* - It will be used later as setting value for Metadata.
*/
mCameraAttitude.snapshot();
if (mCallback != null) {
mCallback.onShutter();
}
} else if (!mIsCapturing && mIsDuringExposure) {
mIsDuringExposure = false;
/*
* Acquire the camera parameters for metadata at the completion of exposure
*/
mParameters = mCamera.getParameters();
CameraSettings.setCameraParameters(mParameters);
} else {
mIsCapturing = false;
mIsDuringExposure = false;
}
}
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant