diff options
author | Pannag Sanketi <psanketi@google.com> | 2012-04-26 14:29:21 -0700 |
---|---|---|
committer | Pannag Sanketi <psanketi@google.com> | 2012-04-26 15:46:17 -0700 |
commit | 2f708ce9cc7fc2e4d498bcc20a095bdf8e9c803d (patch) | |
tree | df3e27847c6b7e7f45615c4e37456567ec729106 /media | |
parent | 1b8f499a14a4340d3422d95c7f6fdc8c0c72b3a4 (diff) | |
download | frameworks_base-2f708ce9cc7fc2e4d498bcc20a095bdf8e9c803d.zip frameworks_base-2f708ce9cc7fc2e4d498bcc20a095bdf8e9c803d.tar.gz frameworks_base-2f708ce9cc7fc2e4d498bcc20a095bdf8e9c803d.tar.bz2 |
Resolving the black screen / crash in effects
b:/6278826
The SurfaceTextureTarget Filter was not unregistering the surface
on closing leading to crashes and blank screens.
Change-Id: Ia9f6fc69b92d5a5e2e1e3803969152d11528aa3d
Diffstat (limited to 'media')
-rw-r--r-- | media/mca/filterpacks/java/android/filterpacks/videosrc/SurfaceTextureTarget.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/media/mca/filterpacks/java/android/filterpacks/videosrc/SurfaceTextureTarget.java b/media/mca/filterpacks/java/android/filterpacks/videosrc/SurfaceTextureTarget.java index 436caab..20e4b32 100644 --- a/media/mca/filterpacks/java/android/filterpacks/videosrc/SurfaceTextureTarget.java +++ b/media/mca/filterpacks/java/android/filterpacks/videosrc/SurfaceTextureTarget.java @@ -160,9 +160,22 @@ public class SurfaceTextureTarget extends Filter { @Override public void open(FilterContext context) { // Set up SurfaceTexture internals - mSurfaceId = context.getGLEnvironment().registerSurfaceTexture(mSurfaceTexture, mScreenWidth, mScreenHeight); + mSurfaceId = context.getGLEnvironment().registerSurfaceTexture( + mSurfaceTexture, mScreenWidth, mScreenHeight); + if (mSurfaceId <= 0) { + throw new RuntimeException("Could not register SurfaceTexture: " + mSurfaceTexture); + } } + + @Override + public void close(FilterContext context) { + if (mSurfaceId > 0) { + context.getGLEnvironment().unregisterSurfaceId(mSurfaceId); + } + } + + @Override public void process(FilterContext context) { if (mLogVerbose) Log.v(TAG, "Starting frame processing"); @@ -173,9 +186,11 @@ public class SurfaceTextureTarget extends Filter { Frame input = pullInput("frame"); boolean createdFrame = false; - float currentAspectRatio = (float)input.getFormat().getWidth() / input.getFormat().getHeight(); + float currentAspectRatio = + (float)input.getFormat().getWidth() / input.getFormat().getHeight(); if (currentAspectRatio != mAspectRatio) { - if (mLogVerbose) Log.v(TAG, "New aspect ratio: " + currentAspectRatio +", previously: " + mAspectRatio); + if (mLogVerbose) Log.v(TAG, "New aspect ratio: " + currentAspectRatio + + ", previously: " + mAspectRatio); mAspectRatio = currentAspectRatio; updateTargetRect(); } |