Index: media/gpu/avda_picture_buffer_manager.cc |
diff --git a/media/gpu/avda_picture_buffer_manager.cc b/media/gpu/avda_picture_buffer_manager.cc |
index 27a7eb82d6b5473dfe8ee1cf2404106c9bd35fa4..b37a3885396db53263571a716084fde24c761fd3 100644 |
--- a/media/gpu/avda_picture_buffer_manager.cc |
+++ b/media/gpu/avda_picture_buffer_manager.cc |
@@ -72,23 +72,28 @@ AVDAPictureBufferManager::AVDAPictureBufferManager( |
AVDAPictureBufferManager::~AVDAPictureBufferManager() {} |
-void AVDAPictureBufferManager::InitializeForOverlay() { |
- shared_state_ = new AVDASharedState(); |
+bool AVDAPictureBufferManager::Initialize( |
+ scoped_refptr<AVDASurfaceBundle> surface_bundle) { |
+ shared_state_ = nullptr; |
surface_texture_ = nullptr; |
-} |
-gl::ScopedJavaSurface AVDAPictureBufferManager::InitializeForSurfaceTexture() { |
- shared_state_ = new AVDASharedState(); |
- surface_texture_ = nullptr; |
+ if (!surface_bundle->overlay) { |
+ // Create the surface texture. |
+ surface_texture_ = |
+ CreateAttachedSurfaceTexture(state_provider_->GetGlDecoder()); |
+ if (!surface_texture_) |
+ return false; |
+ |
+ surface_bundle->surface_texture_surface = |
+ gl::ScopedJavaSurface(surface_texture_.get()); |
+ surface_bundle->surface_texture = surface_texture_; |
+ } |
- // Create a SurfaceTexture. |
- surface_texture_ = |
- CreateAttachedSurfaceTexture(state_provider_->GetGlDecoder()); |
- if (!surface_texture_) |
- return gl::ScopedJavaSurface(); |
+ // Only do this once the surface texture is filled in, since the constructor |
+ // assumes that it will be. |
+ shared_state_ = new AVDASharedState(surface_bundle); |
- shared_state_->SetSurfaceTexture(surface_texture_); |
- return gl::ScopedJavaSurface(surface_texture_.get()); |
+ return true; |
} |
void AVDAPictureBufferManager::Destroy(const PictureBufferMap& buffers) { |