| Index: content/common/gpu/stream_texture_android.cc
|
| diff --git a/content/common/gpu/stream_texture_android.cc b/content/common/gpu/stream_texture_android.cc
|
| index 20f1da7e53884ed4cba5b4018ad46e05e94f3825..940f1f0f9740d6fd8702435946cbfdd25cf8983e 100644
|
| --- a/content/common/gpu/stream_texture_android.cc
|
| +++ b/content/common/gpu/stream_texture_android.cc
|
| @@ -38,15 +38,16 @@ bool StreamTexture::Create(
|
|
|
| // TODO: Ideally a valid image id was returned to the client so that
|
| // it could then call glBindTexImage2D() for doing the following.
|
| - scoped_refptr<gfx::GLImage> gl_image(
|
| - new StreamTexture(owner_stub, stream_id, texture->service_id()));
|
| + scoped_refptr<gfx::GLImage> gl_image(new StreamTexture(
|
| + owner_stub, stream_id, client_texture_id, texture->service_id()));
|
| gfx::Size size = gl_image->GetSize();
|
| texture_manager->SetTarget(texture, GL_TEXTURE_EXTERNAL_OES);
|
| texture_manager->SetLevelInfo(texture, GL_TEXTURE_EXTERNAL_OES, 0, GL_RGBA,
|
| size.width(), size.height(), 1, 0, GL_RGBA,
|
| GL_UNSIGNED_BYTE, gfx::Rect(size));
|
| - texture_manager->SetLevelImage(
|
| - texture, GL_TEXTURE_EXTERNAL_OES, 0, gl_image.get());
|
| + texture_manager->SetLevelImage(texture, GL_TEXTURE_EXTERNAL_OES, 0,
|
| + gl_image.get(),
|
| + gpu::gles2::Texture::UNBOUND);
|
| return true;
|
| }
|
|
|
| @@ -55,6 +56,7 @@ bool StreamTexture::Create(
|
|
|
| StreamTexture::StreamTexture(GpuCommandBufferStub* owner_stub,
|
| int32 route_id,
|
| + uint32 client_texture_id,
|
| uint32 texture_id)
|
| : surface_texture_(gfx::SurfaceTexture::Create(texture_id)),
|
| size_(0, 0),
|
| @@ -63,6 +65,7 @@ StreamTexture::StreamTexture(GpuCommandBufferStub* owner_stub,
|
| owner_stub_(owner_stub),
|
| route_id_(route_id),
|
| has_listener_(false),
|
| + client_texture_id_(client_texture_id),
|
| weak_factory_(this) {
|
| owner_stub->AddDestructionObserver(this);
|
| memset(current_matrix_, 0, sizeof(current_matrix_));
|
| @@ -92,9 +95,11 @@ void StreamTexture::Destroy(bool have_context) {
|
| NOTREACHED();
|
| }
|
|
|
| -void StreamTexture::WillUseTexImage() {
|
| +bool StreamTexture::CopyTexImage(unsigned target) {
|
| + DCHECK_EQ(target, static_cast<unsigned>(GL_TEXTURE_EXTERNAL_OES));
|
| +
|
| if (!owner_stub_ || !surface_texture_.get())
|
| - return;
|
| + return true;
|
|
|
| if (has_pending_frame_) {
|
| scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current;
|
| @@ -128,6 +133,15 @@ void StreamTexture::WillUseTexImage() {
|
| ? active_unit.bound_texture_external_oes->service_id()
|
| : 0);
|
| }
|
| +
|
| + TextureManager* texture_manager =
|
| + owner_stub_->decoder()->GetContextGroup()->texture_manager();
|
| + TextureRef* texture = texture_manager->GetTexture(client_texture_id_);
|
| + // By setting image state to UNBOUND instead of COPIED we ensure that
|
| + // CopyTexImage() is called each time the surface texture is used for
|
| + // drawing.
|
| + texture_manager->SetLevelImage(texture, GL_TEXTURE_EXTERNAL_OES, 0, this,
|
| + gpu::gles2::Texture::UNBOUND);
|
| }
|
|
|
| if (has_listener_ && has_valid_frame_) {
|
| @@ -144,6 +158,8 @@ void StreamTexture::WillUseTexImage() {
|
| new GpuStreamTextureMsg_MatrixChanged(route_id_, params));
|
| }
|
| }
|
| +
|
| + return true;
|
| }
|
|
|
| void StreamTexture::OnFrameAvailable() {
|
|
|