Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: media/gpu/avda_picture_buffer_manager.cc

Issue 2461073002: Use MediaCodec.setOutputSurface() for fullscreen transitions on M. (Closed)
Patch Set: Fix IPC, but now everything explodes :( Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 surface_texture_ = CreateAttachedSurfaceTexture( 147 surface_texture_ = CreateAttachedSurfaceTexture(
148 state_provider_->GetGlDecoder(), &service_id); 148 state_provider_->GetGlDecoder(), &service_id);
149 if (surface_texture_) { 149 if (surface_texture_) {
150 on_frame_available_handler_ = new OnFrameAvailableHandler( 150 on_frame_available_handler_ = new OnFrameAvailableHandler(
151 shared_state_.get(), surface_texture_.get()); 151 shared_state_.get(), surface_texture_.get());
152 } 152 }
153 shared_state_->SetSurfaceTexture(surface_texture_, service_id); 153 shared_state_->SetSurfaceTexture(surface_texture_, service_id);
154 return gl::ScopedJavaSurface(surface_texture_.get()); 154 return gl::ScopedJavaSurface(surface_texture_.get());
155 } 155 }
156 156
157 gl::ScopedJavaSurface AVDAPictureBufferManager::SetSurface(int surface_id) {
158 // Acquire the SurfaceView surface if given a valid id.
159 if (surface_id != VideoDecodeAccelerator::Config::kNoSurfaceID) {
160 shared_state_->SetSurfaceTexture(nullptr, 0);
161 on_frame_available_handler_ = nullptr;
162 surface_texture_ = nullptr;
163 return gpu::GpuSurfaceLookup::GetInstance()->AcquireJavaSurface(surface_id);
164 }
165
166 // Otherwise create a SurfaceTexture.
167 GLuint service_id = 0;
168 surface_texture_ = CreateAttachedSurfaceTexture(
169 state_provider_->GetGlDecoder(), &service_id);
170 if (surface_texture_) {
171 on_frame_available_handler_ = new OnFrameAvailableHandler(
liberato (no reviews please) 2016/11/01 20:57:16 it was probably using the old |service_id| in the
DaleCurtis 2016/11/03 19:32:36 Thanks for this! The latest patch set uses this me
172 shared_state_.get(), surface_texture_.get());
173 }
174 shared_state_->SetSurfaceTexture(surface_texture_, service_id);
175 return gl::ScopedJavaSurface(surface_texture_.get());
176 }
177
157 void AVDAPictureBufferManager::Destroy(const PictureBufferMap& buffers) { 178 void AVDAPictureBufferManager::Destroy(const PictureBufferMap& buffers) {
158 // Do nothing if Initialize() has not been called. 179 // Do nothing if Initialize() has not been called.
159 if (!shared_state_) 180 if (!shared_state_)
160 return; 181 return;
161 182
162 // If we have an OnFrameAvailable handler, tell it that we no longer want 183 // If we have an OnFrameAvailable handler, tell it that we no longer want
163 // callbacks. 184 // callbacks.
164 if (on_frame_available_handler_) 185 if (on_frame_available_handler_)
165 on_frame_available_handler_->ClearListener(); 186 on_frame_available_handler_->ClearListener();
166 187
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 shared_state_->CodecChanged(codec); 414 shared_state_->CodecChanged(codec);
394 } 415 }
395 416
396 bool AVDAPictureBufferManager::ArePicturesOverlayable() { 417 bool AVDAPictureBufferManager::ArePicturesOverlayable() {
397 // SurfaceView frames are always overlayable because that's the only way to 418 // SurfaceView frames are always overlayable because that's the only way to
398 // display them. 419 // display them.
399 return !surface_texture_; 420 return !surface_texture_;
400 } 421 }
401 422
402 } // namespace media 423 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698