summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Teng-Hui Zhu <ztenghui@google.com> 2011-11-02 15:50:00 -0700
committer Teng-Hui Zhu <ztenghui@google.com> 2011-11-02 15:59:25 -0700
commit1f5467338115c7e5ad1cfa54c362be86028bd6ea (patch)
tree2c0bfacfdd37498f7f1c7211b8f37a3d6210ebad
parentca4100da0a0481b3b9f464bbc8842b571e8c60d5 (diff)
Create GL texture when it is missing for video layer
In any case that the HTMLVideoView is recreated with no GL texture, we should recreate the GL texture to make sure we always have a valid texture ID. bug:5530006 Change-Id: I703a987a7530dbeef74e502f3c9ff329beca8c4e
-rw-r--r--core/java/android/webkit/HTML5VideoInline.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/webkit/HTML5VideoInline.java b/core/java/android/webkit/HTML5VideoInline.java
index 42581c2fa51d..fe5908e5ba84 100644
--- a/core/java/android/webkit/HTML5VideoInline.java
+++ b/core/java/android/webkit/HTML5VideoInline.java
@@ -74,11 +74,13 @@ public class HTML5VideoInline extends HTML5VideoView{
public SurfaceTexture getSurfaceTexture(int videoLayerId) {
// Create the surface texture.
if (videoLayerId != mVideoLayerUsingSurfaceTexture
- || mSurfaceTexture == null) {
- if (mTextureNames == null) {
- mTextureNames = new int[1];
- GLES20.glGenTextures(1, mTextureNames, 0);
+ || mSurfaceTexture == null
+ || mTextureNames == null) {
+ if (mTextureNames != null) {
+ GLES20.glDeleteTextures(1, mTextureNames, 0);
}
+ mTextureNames = new int[1];
+ GLES20.glGenTextures(1, mTextureNames, 0);
mSurfaceTexture = new SurfaceTexture(mTextureNames[0]);
}
mVideoLayerUsingSurfaceTexture = videoLayerId;