diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2011-11-17 11:34:20 -0800 |
---|---|---|
committer | The Android Automerger <android-build@android.com> | 2011-12-06 05:23:13 -0800 |
commit | 496a743a14eed55feb734d715f68fb8d5d8a0e27 (patch) | |
tree | 64a728450be40ad06d9bac8fad23cf2f8e286a8e | |
parent | c157a9c259474d4e1736c4f9ccccad10b5000734 (diff) | |
download | android_system_media-496a743a14eed55feb734d715f68fb8d5d8a0e27.tar.gz android_system_media-496a743a14eed55feb734d715f68fb8d5d8a0e27.tar.bz2 android_system_media-496a743a14eed55feb734d715f68fb8d5d8a0e27.zip |
DO NOT MERGE: Fix ordering of SurfaceTexture startup in SurfaceTextureSource.
Minimal cherry-pick from MR1.
An asynchronous SurfaceTexture only sends out a frame available
callback the first time a new buffer comes in; if a onFrameAvailable-
listener is not registered at this point, the callback never happens
even when new frames come in.
SurfaceTextureSource was calling its onSurfaceTextureSourceReady-
listener with a newly created SurfaceTexture before hooking up the
SurfaceTexture's onFrameAvailable-listener. This opened a window of
time for the onSurfaceTextureSourceReady-listener to set up the
provider end of the SurfaceTexture, and for the provider to get
buffers into the SurfaceTexture queue before the
onFrameAvailable-listener was registered.
And as a result, no new frame callback ever fired, and
SurfaceTextureSource eventually times out, or goes into permanent
sleep.
This change simply makes sure the onFrameAvailable-listener is
registered before the onSurfaceTextureSourceReady callback is fired.
Bug: 5614661
Change-Id: I8d6a72444ffc36b5c48952d0b1edd530ecb76478
-rw-r--r-- | mca/filterpacks/videosrc/java/SurfaceTextureSource.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mca/filterpacks/videosrc/java/SurfaceTextureSource.java b/mca/filterpacks/videosrc/java/SurfaceTextureSource.java index 29eaa016..c9efe76e 100644 --- a/mca/filterpacks/videosrc/java/SurfaceTextureSource.java +++ b/mca/filterpacks/videosrc/java/SurfaceTextureSource.java @@ -181,10 +181,10 @@ public class SurfaceTextureSource extends Filter { if (mLogVerbose) Log.v(TAG, "Opening SurfaceTextureSource"); // Create SurfaceTexture anew each time - it can use substantial memory. mSurfaceTexture = new SurfaceTexture(mMediaFrame.getTextureId()); - // Connect SurfaceTexture to source - mSourceListener.onSurfaceTextureSourceReady(mSurfaceTexture); // Connect SurfaceTexture to callback mSurfaceTexture.setOnFrameAvailableListener(onFrameAvailableListener); + // Connect SurfaceTexture to source + mSourceListener.onSurfaceTextureSourceReady(mSurfaceTexture); mFirstFrame = true; } |