diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2011-10-20 16:22:19 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-20 16:22:19 -0700 |
commit | 74ec1a362dc1ddc7835fcfb2a578e3d8f58e6355 (patch) | |
tree | 0fedd4d3d71fb648890b46d54a0897180874e6a6 | |
parent | 4f6e602692a83ec2dce6d124da73442bc13dca87 (diff) | |
parent | 58cede9e3e8004f6be9731e9cb9a135238a2efd8 (diff) | |
download | LegacyCamera-74ec1a362dc1ddc7835fcfb2a578e3d8f58e6355.zip LegacyCamera-74ec1a362dc1ddc7835fcfb2a578e3d8f58e6355.tar.gz LegacyCamera-74ec1a362dc1ddc7835fcfb2a578e3d8f58e6355.tar.bz2 |
Merge "Effects: shut down camera preview when unexpected graph closures occur." into ics-mr0
-rw-r--r-- | src/com/android/camera/EffectsRecorder.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/com/android/camera/EffectsRecorder.java b/src/com/android/camera/EffectsRecorder.java index 7c81bf0..a9aa51b 100644 --- a/src/com/android/camera/EffectsRecorder.java +++ b/src/com/android/camera/EffectsRecorder.java @@ -554,12 +554,25 @@ public class EffectsRecorder { synchronized(EffectsRecorder.this) { mTextureSource = source; - // When shutting down a graph, we receive a null SurfaceTexture to - // indicate that. Don't want to connect up the camera in that case. - if (source == null) return; - if (mState == STATE_RELEASED) return; + if (source == null) { + if (mState == STATE_PREVIEW || + mState == STATE_RECORD) { + // A null source here means the graph is shutting down + // unexpectedly, so we need to turn off preview before + // the surface texture goes away. + mCameraDevice.stopPreview(); + try { + mCameraDevice.setPreviewTexture(null); + } catch(IOException e) { + throw new RuntimeException("Unable to disconnect " + + "camera from effect input", e); + } + } + return; + } + // Lock AE/AWB to reduce transition flicker tryEnable3ALocks(true); |