diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2011-10-20 12:42:22 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2011-10-20 15:42:22 -0700 |
commit | 58cede9e3e8004f6be9731e9cb9a135238a2efd8 (patch) | |
tree | 216cab0dd64380cedf1b9c48c507f99597ccc9d7 /src/com/android/camera | |
parent | 7b9a10fef160cd452f7905ee52f7b9ac2262faf5 (diff) | |
download | LegacyCamera-58cede9e3e8004f6be9731e9cb9a135238a2efd8.zip LegacyCamera-58cede9e3e8004f6be9731e9cb9a135238a2efd8.tar.gz LegacyCamera-58cede9e3e8004f6be9731e9cb9a135238a2efd8.tar.bz2 |
Effects: shut down camera preview when unexpected graph closures occur.
If the graph runner needs to shut down a graph due to an error, previously
the surface texture connecting the camera to the processing graph would get
released before camera was told to shut down preview. This led to various
abandoned surfacetexture errors in the camera HAL, sometimes including
native crashes.
Now properly uses the SurfaceTextureSource callback to detect unexpected
graph shutdown to clean up the camera before the SurfaceTexture is released.
Bug: 5451833
Change-Id: Id130c1e5deb27cffab335affaa1ed55f04c260a5
Diffstat (limited to 'src/com/android/camera')
-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); |