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

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

Issue 2095873005: Add SurfaceTexture::release and call it from AVDA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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/android_copying_backing_strategy.h" 5 #include "media/gpu/android_copying_backing_strategy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "gpu/command_buffer/service/context_group.h" 10 #include "gpu/command_buffer/service/context_group.h"
(...skipping 21 matching lines...) Expand all
32 LOG(ERROR) << "The copying strategy should not be initialized with a " 32 LOG(ERROR) << "The copying strategy should not be initialized with a "
33 "surface id."; 33 "surface id.";
34 return gl::ScopedJavaSurface(); 34 return gl::ScopedJavaSurface();
35 } 35 }
36 36
37 surface_texture_ = 37 surface_texture_ =
38 state_provider_->CreateAttachedSurfaceTexture(&surface_texture_id_); 38 state_provider_->CreateAttachedSurfaceTexture(&surface_texture_id_);
39 return gl::ScopedJavaSurface(surface_texture_.get()); 39 return gl::ScopedJavaSurface(surface_texture_.get());
40 } 40 }
41 41
42 void AndroidCopyingBackingStrategy::Cleanup( 42 void AndroidCopyingBackingStrategy::BeginCleanup(
43 bool have_context, 43 bool have_context,
44 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) { 44 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) {
45 DCHECK(state_provider_->ThreadChecker().CalledOnValidThread()); 45 DCHECK(state_provider_->ThreadChecker().CalledOnValidThread());
46 46
47 if (copier_) 47 if (copier_)
48 copier_->Destroy(); 48 copier_->Destroy();
49 49
50 if (surface_texture_id_ && have_context) 50 if (surface_texture_id_ && have_context)
51 glDeleteTextures(1, &surface_texture_id_); 51 glDeleteTextures(1, &surface_texture_id_);
52 } 52 }
53 53
54 void AndroidCopyingBackingStrategy::EndCleanup() {}
55
54 scoped_refptr<gl::SurfaceTexture> 56 scoped_refptr<gl::SurfaceTexture>
55 AndroidCopyingBackingStrategy::GetSurfaceTexture() const { 57 AndroidCopyingBackingStrategy::GetSurfaceTexture() const {
56 return surface_texture_; 58 return surface_texture_;
57 } 59 }
58 60
59 uint32_t AndroidCopyingBackingStrategy::GetTextureTarget() const { 61 uint32_t AndroidCopyingBackingStrategy::GetTextureTarget() const {
60 return GL_TEXTURE_2D; 62 return GL_TEXTURE_2D;
61 } 63 }
62 64
63 gfx::Size AndroidCopyingBackingStrategy::GetPictureBufferSize() const { 65 gfx::Size AndroidCopyingBackingStrategy::GetPictureBufferSize() const {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 RETURN_IF_NULL(texture_ref); 170 RETURN_IF_NULL(texture_ref);
169 gpu::gles2::TextureManager* texture_manager = 171 gpu::gles2::TextureManager* texture_manager =
170 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager(); 172 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager();
171 RETURN_IF_NULL(texture_manager); 173 RETURN_IF_NULL(texture_manager);
172 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA, 174 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA,
173 new_size.width(), new_size.height(), 1, 0, 175 new_size.width(), new_size.height(), 1, 0,
174 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(new_size)); 176 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(new_size));
175 } 177 }
176 178
177 } // namespace media 179 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698