Chromium Code Reviews| Index: content/common/gpu/media/android_copying_backing_strategy.cc |
| diff --git a/content/common/gpu/media/android_copying_backing_strategy.cc b/content/common/gpu/media/android_copying_backing_strategy.cc |
| index f80a16f3d72da05a59b3be947857dc0baf86b6de..952403398802cf613726e22f40a03fa1a4ebdf1d 100644 |
| --- a/content/common/gpu/media/android_copying_backing_strategy.cc |
| +++ b/content/common/gpu/media/android_copying_backing_strategy.cc |
| @@ -26,28 +26,14 @@ AndroidCopyingBackingStrategy::AndroidCopyingBackingStrategy() |
| AndroidCopyingBackingStrategy::~AndroidCopyingBackingStrategy() {} |
| -void AndroidCopyingBackingStrategy::Initialize( |
| - AVDAStateProvider* state_provider) { |
| +gfx::ScopedJavaSurface AndroidCopyingBackingStrategy::Initialize( |
|
liberato (no reviews please)
2016/01/27 16:15:33
that's a good idea.
|
| + AVDAStateProvider* state_provider, |
| + int surface_view_id) { |
| + DCHECK(surface_view_id == |
|
DaleCurtis
2016/01/27 21:48:13
DCHECK_EQ
|
| + media::VideoDecodeAccelerator::Config::kNoSurfaceID); |
| state_provider_ = state_provider; |
| -} |
| -void AndroidCopyingBackingStrategy::Cleanup( |
| - bool have_context, |
| - const AndroidVideoDecodeAccelerator::OutputBufferMap&) { |
| - DCHECK(state_provider_->ThreadChecker().CalledOnValidThread()); |
| - if (copier_) |
| - copier_->Destroy(); |
| - |
| - if (surface_texture_id_ && have_context) |
| - glDeleteTextures(1, &surface_texture_id_); |
| -} |
| - |
| -uint32_t AndroidCopyingBackingStrategy::GetTextureTarget() const { |
| - return GL_TEXTURE_2D; |
| -} |
| - |
| -scoped_refptr<gfx::SurfaceTexture> |
| -AndroidCopyingBackingStrategy::CreateSurfaceTexture() { |
| + // Create a texture and attach the SurfaceTexture to it. |
| glGenTextures(1, &surface_texture_id_); |
| glActiveTexture(GL_TEXTURE0); |
| glBindTexture(GL_TEXTURE_EXTERNAL_OES, surface_texture_id_); |
| @@ -56,14 +42,35 @@ AndroidCopyingBackingStrategy::CreateSurfaceTexture() { |
| glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| + |
| state_provider_->GetGlDecoder()->RestoreTextureUnitBindings(0); |
| state_provider_->GetGlDecoder()->RestoreActiveTexture(); |
| surface_texture_ = gfx::SurfaceTexture::Create(surface_texture_id_); |
| + return gfx::ScopedJavaSurface(surface_texture_.get()); |
| +} |
| + |
| +void AndroidCopyingBackingStrategy::Cleanup( |
| + bool have_context, |
| + const AndroidVideoDecodeAccelerator::OutputBufferMap&) { |
| + DCHECK(state_provider_->ThreadChecker().CalledOnValidThread()); |
| + if (copier_) |
| + copier_->Destroy(); |
| + |
| + if (surface_texture_id_ && have_context) |
| + glDeleteTextures(1, &surface_texture_id_); |
| +} |
| + |
| +scoped_refptr<gfx::SurfaceTexture> |
| +AndroidCopyingBackingStrategy::GetSurfaceTexture() const { |
| return surface_texture_; |
| } |
| +uint32_t AndroidCopyingBackingStrategy::GetTextureTarget() const { |
| + return GL_TEXTURE_2D; |
| +} |
| + |
| void AndroidCopyingBackingStrategy::UseCodecBufferForPictureBuffer( |
| int32_t codec_buf_index, |
| const media::PictureBuffer& picture_buffer) { |