| 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..050695484bb1fe0c735faa448b2983d2a7f9b70c 100644
|
| --- a/content/common/gpu/media/android_copying_backing_strategy.cc
|
| +++ b/content/common/gpu/media/android_copying_backing_strategy.cc
|
| @@ -27,27 +27,13 @@ AndroidCopyingBackingStrategy::AndroidCopyingBackingStrategy()
|
| AndroidCopyingBackingStrategy::~AndroidCopyingBackingStrategy() {}
|
|
|
| void AndroidCopyingBackingStrategy::Initialize(
|
| - AVDAStateProvider* state_provider) {
|
| + AVDAStateProvider* state_provider,
|
| + scoped_refptr<gfx::SurfaceTexture> surface_texture) {
|
| + DCHECK(surface_texture);
|
| state_provider_ = state_provider;
|
| -}
|
| + surface_texture_ = surface_texture;
|
|
|
| -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,12 +42,26 @@ 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);
|
| +
|
| + surface_texture_->AttachToGLContext();
|
| +
|
| state_provider_->GetGlDecoder()->RestoreTextureUnitBindings(0);
|
| state_provider_->GetGlDecoder()->RestoreActiveTexture();
|
| +}
|
|
|
| - surface_texture_ = gfx::SurfaceTexture::Create(surface_texture_id_);
|
| +void AndroidCopyingBackingStrategy::Cleanup(
|
| + bool have_context,
|
| + const AndroidVideoDecodeAccelerator::OutputBufferMap&) {
|
| + DCHECK(state_provider_->ThreadChecker().CalledOnValidThread());
|
| + if (copier_)
|
| + copier_->Destroy();
|
|
|
| - return surface_texture_;
|
| + if (surface_texture_id_ && have_context)
|
| + glDeleteTextures(1, &surface_texture_id_);
|
| +}
|
| +
|
| +uint32_t AndroidCopyingBackingStrategy::GetTextureTarget() const {
|
| + return GL_TEXTURE_2D;
|
| }
|
|
|
| void AndroidCopyingBackingStrategy::UseCodecBufferForPictureBuffer(
|
|
|