OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/gpu/avda_picture_buffer_manager.h" | 5 #include "media/gpu/avda_picture_buffer_manager.h" |
6 | 6 |
7 #include <EGL/egl.h> | 7 #include <EGL/egl.h> |
8 #include <EGL/eglext.h> | 8 #include <EGL/eglext.h> |
9 | 9 |
10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 : state_provider_(nullptr), media_codec_(nullptr) {} | 129 : state_provider_(nullptr), media_codec_(nullptr) {} |
130 | 130 |
131 AVDAPictureBufferManager::~AVDAPictureBufferManager() {} | 131 AVDAPictureBufferManager::~AVDAPictureBufferManager() {} |
132 | 132 |
133 gl::ScopedJavaSurface AVDAPictureBufferManager::Initialize( | 133 gl::ScopedJavaSurface AVDAPictureBufferManager::Initialize( |
134 AVDAStateProvider* state_provider, | 134 AVDAStateProvider* state_provider, |
135 int surface_view_id) { | 135 int surface_view_id) { |
136 state_provider_ = state_provider; | 136 state_provider_ = state_provider; |
137 shared_state_ = new AVDASharedState(); | 137 shared_state_ = new AVDASharedState(); |
138 | 138 |
139 bool using_virtual_context = false; | |
140 if (gl::GLContext* context = gl::GLContext::GetCurrent()) { | |
141 if (gl::GLShareGroup* share_group = context->share_group()) | |
142 using_virtual_context = | |
143 !!share_group->GetSharedContext(gl::GLSurface::GetCurrent()); | |
144 } | |
145 UMA_HISTOGRAM_BOOLEAN("Media.AVDA.VirtualContext", using_virtual_context); | |
146 | |
147 // Acquire the SurfaceView surface if given a valid id. | 139 // Acquire the SurfaceView surface if given a valid id. |
148 if (surface_view_id != VideoDecodeAccelerator::Config::kNoSurfaceID) { | 140 if (surface_view_id != VideoDecodeAccelerator::Config::kNoSurfaceID) { |
149 return gpu::GpuSurfaceLookup::GetInstance()->AcquireJavaSurface( | 141 return gpu::GpuSurfaceLookup::GetInstance()->AcquireJavaSurface( |
150 surface_view_id); | 142 surface_view_id); |
151 } | 143 } |
152 | 144 |
153 // Otherwise create a SurfaceTexture. | 145 // Otherwise create a SurfaceTexture. |
154 GLuint service_id = 0; | 146 GLuint service_id = 0; |
155 surface_texture_ = CreateAttachedSurfaceTexture( | 147 surface_texture_ = CreateAttachedSurfaceTexture( |
156 state_provider_->GetGlDecoder(), &service_id); | 148 state_provider_->GetGlDecoder(), &service_id); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 shared_state_->CodecChanged(codec); | 393 shared_state_->CodecChanged(codec); |
402 } | 394 } |
403 | 395 |
404 bool AVDAPictureBufferManager::ArePicturesOverlayable() { | 396 bool AVDAPictureBufferManager::ArePicturesOverlayable() { |
405 // SurfaceView frames are always overlayable because that's the only way to | 397 // SurfaceView frames are always overlayable because that's the only way to |
406 // display them. | 398 // display them. |
407 return !surface_texture_; | 399 return !surface_texture_; |
408 } | 400 } |
409 | 401 |
410 } // namespace media | 402 } // namespace media |
OLD | NEW |