diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2011-10-20 16:25:03 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-10-20 16:25:03 -0700 |
commit | b636db196377712807d81ecd34770d07f4b0706e (patch) | |
tree | 1d86e79a4b8038af4af8663b23efebb9df339683 | |
parent | c1c7f9edd5086ce2f6af7e079f5b55455ce69ec7 (diff) | |
parent | 74ec1a362dc1ddc7835fcfb2a578e3d8f58e6355 (diff) | |
download | LegacyCamera-b636db196377712807d81ecd34770d07f4b0706e.zip LegacyCamera-b636db196377712807d81ecd34770d07f4b0706e.tar.gz LegacyCamera-b636db196377712807d81ecd34770d07f4b0706e.tar.bz2 |
am 74ec1a36: Merge "Effects: shut down camera preview when unexpected graph closures occur." into ics-mr0
* commit '74ec1a362dc1ddc7835fcfb2a578e3d8f58e6355':
Effects: shut down camera preview when unexpected graph closures occur.
-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); |