Permalink
Browse files

Fix the crash when choosing pick your video in effects recording.

In pick your video case, mEffectType is not EFFECTS_NONE and
mEffectsRecorder is null in onPause.

bug:6826528

Change-Id: Id8c933555b1b8a37c541deb04746468efe1787c0
  • Loading branch information...
1 parent aca6156 commit 97a8b0ac97839af04a9bab054ce71169f6c007c9 Wu-cheng Li committed with The Android Open Source Project Jul 17, 2012
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/com/android/camera/VideoCamera.java
@@ -851,6 +851,7 @@ private void startPreview() {
stopPreview();
if (effectsActive() && mEffectsRecorder != null) {
mEffectsRecorder.release();
+ mEffectsRecorder = null;
}
}
@@ -884,13 +885,15 @@ private void stopPreview() {
// Closing the effects out. Will shut down the effects graph.
private void closeEffects() {
Log.v(TAG, "Closing effects");
+ mEffectType = EffectsRecorder.EFFECT_NONE;
if (mEffectsRecorder == null) {
Log.d(TAG, "Effects are already closed. Nothing to do");
+ return;
}
// This call can handle the case where the camera is already released
// after the recording has been stopped.
mEffectsRecorder.release();
- mEffectType = EffectsRecorder.EFFECT_NONE;
+ mEffectsRecorder = null;
}
// By default, we want to close the effects as well with the camera.
@@ -920,10 +923,8 @@ private void closeCamera(boolean closeEffectsAlso) {
// Disconnect the camera from effects so that camera is ready to
// be released to the outside world.
mEffectsRecorder.disconnectCamera();
- if (closeEffectsAlso) {
- closeEffects();
- }
}
+ if (closeEffectsAlso) closeEffects();
mCameraDevice.setZoomChangeListener(null);
mCameraDevice.setErrorCallback(null);
CameraHolder.instance().release();
@@ -1287,8 +1288,8 @@ private void releaseEffectsRecorder() {
cleanupEmptyFile();
mEffectsRecorder.release();
mEffectsRecorder = null;
- mEffectType = EffectsRecorder.EFFECT_NONE;
}
+ mEffectType = EffectsRecorder.EFFECT_NONE;
mVideoFilename = null;
}
@@ -2148,6 +2149,7 @@ public void onSharedPreferenceChanged() {
stopPreview();
} else {
mEffectsRecorder.release();
+ mEffectsRecorder = null;
}
resizeForPreviewAspectRatio();
startPreview(); // Parameters will be set in startPreview().

0 comments on commit 97a8b0a

Please sign in to comment.