Skip to content

Commit 459e459

Browse files
Jamie GennisAndroid (Google) Code Review
authored andcommitted
Merge "TextureView: don't call onSTAvailable due to setST" into jb-dev
2 parents 6113ce3 + 8a34d68 commit 459e459

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/java/android/view/TextureView.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ HardwareLayer getHardwareLayer() {
339339

340340
mLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer(mOpaque);
341341
if (!mUpdateSurface) {
342-
// We already have a SurfaceTexture to use, and we will pass it
343-
// to mLayer below.
342+
// Create a new SurfaceTexture for the layer.
344343
mSurface = mAttachInfo.mHardwareRenderer.createSurfaceTexture(mLayer);
345344
}
346345
nSetDefaultBufferSize(mSurface, getWidth(), getHeight());
@@ -359,7 +358,7 @@ public void onFrameAvailable(SurfaceTexture surfaceTexture) {
359358
};
360359
mSurface.setOnFrameAvailableListener(mUpdateListener);
361360

362-
if (mListener != null) {
361+
if (mListener != null && !mUpdateSurface) {
363362
mListener.onSurfaceTextureAvailable(mSurface, getWidth(), getHeight());
364363
}
365364
}
@@ -669,7 +668,9 @@ public SurfaceTexture getSurfaceTexture() {
669668
* SurfaceTexture} is already being used by this view, it is immediately
670669
* released and not be usable any more. The {@link
671670
* SurfaceTextureListener#onSurfaceTextureDestroyed} callback is <b>not</b>
672-
* called.
671+
* called for the previous {@link SurfaceTexture}. Similarly, the {@link
672+
* SurfaceTextureListener#onSurfaceTextureAvailable} callback is <b>not</b>
673+
* called for the {@link SurfaceTexture} passed to setSurfaceTexture.
673674
*
674675
* The {@link SurfaceTexture} object must be detached from all OpenGL ES
675676
* contexts prior to calling this method.

0 commit comments

Comments
 (0)