| Index: media/gpu/avda_shared_state.cc
|
| diff --git a/media/gpu/avda_shared_state.cc b/media/gpu/avda_shared_state.cc
|
| index 2b53620f39e2144b1165fe82bc54c26e6ab16720..74e5275dd3c2d9cdec013b734b721205170b9608 100644
|
| --- a/media/gpu/avda_shared_state.cc
|
| +++ b/media/gpu/avda_shared_state.cc
|
| @@ -7,17 +7,23 @@
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/time/time.h"
|
| #include "media/gpu/avda_codec_image.h"
|
| +#include "ui/gl/android/surface_texture.h"
|
| #include "ui/gl/gl_bindings.h"
|
| #include "ui/gl/scoped_make_current.h"
|
|
|
| namespace media {
|
|
|
| AVDASharedState::AVDASharedState()
|
| - : surface_texture_service_id_(0),
|
| - frame_available_event_(false, false),
|
| - surface_texture_is_attached_(false) {}
|
| + : surface_texture_service_id_(0), frame_available_event_(false, false) {}
|
|
|
| -AVDASharedState::~AVDASharedState() {}
|
| +AVDASharedState::~AVDASharedState() {
|
| + if (!surface_texture_service_id_)
|
| + return;
|
| +
|
| + ui::ScopedMakeCurrent scoped_make_current(context_.get(), surface_.get());
|
| + if (scoped_make_current.Succeeded())
|
| + glDeleteTextures(1, &surface_texture_service_id_);
|
| +}
|
|
|
| void AVDASharedState::SignalFrameAvailable() {
|
| frame_available_event_.Signal();
|
| @@ -53,13 +59,15 @@ void AVDASharedState::WaitForFrameAvailable() {
|
| }
|
| }
|
|
|
| -void AVDASharedState::DidAttachSurfaceTexture() {
|
| +void AVDASharedState::SetSurfaceTexture(
|
| + scoped_refptr<gl::SurfaceTexture> surface_texture,
|
| + GLuint attached_service_id) {
|
| + surface_texture_ = surface_texture;
|
| + surface_texture_service_id_ = attached_service_id;
|
| context_ = gl::GLContext::GetCurrent();
|
| surface_ = gl::GLSurface::GetCurrent();
|
| DCHECK(context_);
|
| DCHECK(surface_);
|
| -
|
| - surface_texture_is_attached_ = true;
|
| }
|
|
|
| void AVDASharedState::CodecChanged(media::MediaCodecBridge* codec) {
|
|
|