summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPannag Sanketi <psanketi@google.com>2012-05-07 11:38:53 -0700
committerPannag Sanketi <psanketi@google.com>2012-05-18 11:07:44 -0700
commitbc18ce3e7809a4fd7392b2e62a086ca070dc540a (patch)
tree92130ac88c771bdda2f2873df84f633489f32f4b /src
parent016a8758e58665f88e93460326a4068a3c1075e8 (diff)
downloadCamera-bc18ce3e7809a4fd7392b2e62a086ca070dc540a.tar.gz
Fixing the weird preview size w/ effects on camera
The aspect ratio sent from the camera app to the SurfaceTextureTarget filter does not really matter now since the camera app handles the re-sizing. Hence, the SurfaceTextureTarget filter needs to be render in "stretch" mode all the time even though the aspect ratio sent to the filter might indicate otherwise. The filter still needs the correct frame size for things other than determining aspect ratio. Fix b/6430124 Change-Id: I8f63d47cafab05e29e7f2fd2801e359e6dd35691
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/EffectsRecorder.java30
-rwxr-xr-xsrc/com/android/camera/VideoCamera.java3
2 files changed, 11 insertions, 22 deletions
diff --git a/src/com/android/camera/EffectsRecorder.java b/src/com/android/camera/EffectsRecorder.java
index 4bfeda50..aeea2759 100644
--- a/src/com/android/camera/EffectsRecorder.java
+++ b/src/com/android/camera/EffectsRecorder.java
@@ -406,16 +406,6 @@ public class EffectsRecorder {
mGraphEnv = new GraphEnvironment();
mGraphEnv.createGLEnvironment();
- if (mLogVerbose) {
- Log.v(TAG, "Effects framework initializing. Recording size "
- + mProfile.videoFrameWidth + ", " + mProfile.videoFrameHeight);
- }
- if (!mAppIsLandscape) {
- int tmp;
- tmp = mProfile.videoFrameWidth;
- mProfile.videoFrameWidth = mProfile.videoFrameHeight;
- mProfile.videoFrameHeight = tmp;
- }
mGraphEnv.addReferences(
"textureSourceCallback", mSourceReadyCallback,
"recordingWidth", mProfile.videoFrameWidth,
@@ -432,10 +422,6 @@ public class EffectsRecorder {
if (forceReset ||
mCurrentEffect != mEffect ||
mCurrentEffect == EFFECT_BACKDROPPER) {
- if (mLogVerbose) {
- Log.v(TAG, "Effect initializing. Preview size "
- + mPreviewWidth + ", " + mPreviewHeight);
- }
mGraphEnv.addReferences(
"previewSurfaceTexture", mPreviewSurfaceTexture,
@@ -543,14 +529,11 @@ public class EffectsRecorder {
throw new RuntimeException("No camera to record from!");
}
- if (mLogVerbose) Log.v(TAG, "Initializing filter graph");
-
+ if (mLogVerbose) Log.v(TAG, "Initializing filter framework and running the graph.");
initializeFilterFramework();
initializeEffect(true);
- if (mLogVerbose) Log.v(TAG, "Starting filter graph");
-
mState = STATE_STARTING_PREVIEW;
mRunner.run();
// Rest of preview startup handled in mSourceReadyCallback
@@ -578,12 +561,19 @@ public class EffectsRecorder {
return;
}
if (source == null) {
+ if (mLogVerbose) {
+ Log.v(TAG, "Ready callback: source null! Looks like graph was closed!");
+ }
if (mState == STATE_PREVIEW ||
mState == STATE_STARTING_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.
+ if (mLogVerbose) {
+ Log.v(TAG, "Ready callback: State: " + mState + ". stopCameraPreview");
+ }
+
stopCameraPreview();
}
return;
@@ -876,7 +866,9 @@ public class EffectsRecorder {
if (mState == STATE_PREVIEW ||
mState == STATE_STARTING_PREVIEW) {
// Switching effects, start up the new runner
- if (mLogVerbose) Log.v(TAG, "Previous effect halted, starting new effect.");
+ if (mLogVerbose) {
+ Log.v(TAG, "Previous effect halted. Running graph again. state: " + mState);
+ }
tryEnable3ALocks(false);
// In case of an error, the graph restarts from beginning and in case
// of the BACKDROPPER effect, the learner re-learns the background.
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 618c8d3b..a8b689dc 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -843,9 +843,6 @@ public class VideoCamera extends ActivityBase
mSurfaceWidth = mCameraScreenNail.getWidth();
mSurfaceHeight = mCameraScreenNail.getHeight();
initializeEffectsPreview();
- mEffectsRecorder.setPreviewSurfaceTexture(mSurfaceTexture, mSurfaceWidth,
- mSurfaceHeight);
- Log.v(TAG, "effectsStartPreview");
mEffectsRecorder.startPreview();
}
} catch (Throwable ex) {