Chromium Code Reviews| 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..8c90f37955640adfed46286aca24a68d99dc05db 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; |
|
watk
2017/05/17 19:45:14
delete now?
liberato (no reviews please)
2017/05/17 20:19:32
can't, in case of the early out @85.
|
| 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 one the surface texture is filled in, since the constructor |
|
watk
2017/05/17 19:45:14
s/one/once
liberato (no reviews please)
2017/05/17 20:19:32
Done.
|
| + // 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) { |