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
This commit is contained in:
Teng-Hui Zhu
2011-11-02 15:50:00 -07:00
parent ca4100da0a
commit 1f54673381

View File

@ -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;