summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2011-10-24 10:46:00 -0700
committerEino-Ville Talvala <etalvala@google.com>2011-10-24 10:46:00 -0700
commit07b77037f2f5aa28d6d3188f78588dc7f2d49398 (patch)
treeec570e35f198b080926813e8327aa8fa31be1e61 /src/com
parent37eac5970dcac64ddb547f32f4a642c77b83a28f (diff)
downloadLegacyCamera-07b77037f2f5aa28d6d3188f78588dc7f2d49398.zip
LegacyCamera-07b77037f2f5aa28d6d3188f78588dc7f2d49398.tar.gz
LegacyCamera-07b77037f2f5aa28d6d3188f78588dc7f2d49398.tar.bz2
Add missing state check in EffectsRecorder startup path.
When starting up, the EffectsRecorder gets a callback when the effect filter graph provides an input SurfaceTexture. This callback was not checking the EffectsRecorder state correctly, and if stopPreview was called on the EffectsRecorder between startup and before the callback fires, the callback would improperly reset the recorder state, resulting in NPEs down the line. Bug: 5493458 Change-Id: If552b7c0ea82e1506f0b22eb5fa0447c1ca4adf8
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/EffectsRecorder.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/camera/EffectsRecorder.java b/src/com/android/camera/EffectsRecorder.java
index d3b277d..a561011 100644
--- a/src/com/android/camera/EffectsRecorder.java
+++ b/src/com/android/camera/EffectsRecorder.java
@@ -562,8 +562,19 @@ public class EffectsRecorder {
synchronized(EffectsRecorder.this) {
mTextureSource = source;
- if (mState == STATE_RELEASED) return;
-
+ if (mState == STATE_CONFIGURE) {
+ // Stop preview happened while the runner was doing startup tasks
+ // Since we haven't started anything up, don't do anything
+ // Rest of cleanup will happen in onRunnerDone
+ if (mLogVerbose) Log.v(TAG, "Ready callback: Already stopped, skipping.");
+ return;
+ }
+ if (mState == STATE_RELEASED) {
+ // EffectsRecorder has been released, so don't touch the camera device
+ // or anything else
+ if (mLogVerbose) Log.v(TAG, "Ready callback: Already released, skipping.");
+ return;
+ }
if (source == null) {
if (mState == STATE_PREVIEW ||
mState == STATE_STARTING_PREVIEW ||