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

Side by Side Diff: content/common/gpu/media/android_deferred_rendering_backing_strategy.cc

Issue 1421903006: ui/gl: Move GLImage into gl namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ozone demo Created 5 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 "content/common/gpu/media/android_deferred_rendering_backing_strategy.h " 5 #include "content/common/gpu/media/android_deferred_rendering_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/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 texture_manager->GetTexture(picture_buffer.internal_texture_id()); 77 texture_manager->GetTexture(picture_buffer.internal_texture_id());
78 RETURN_NULL_IF_NULL(texture_ref); 78 RETURN_NULL_IF_NULL(texture_ref);
79 79
80 return texture_ref; 80 return texture_ref;
81 } 81 }
82 82
83 AVDACodecImage* AndroidDeferredRenderingBackingStrategy::GetImageForPicture( 83 AVDACodecImage* AndroidDeferredRenderingBackingStrategy::GetImageForPicture(
84 const media::PictureBuffer& picture_buffer) { 84 const media::PictureBuffer& picture_buffer) {
85 gpu::gles2::TextureRef* texture_ref = GetTextureForPicture(picture_buffer); 85 gpu::gles2::TextureRef* texture_ref = GetTextureForPicture(picture_buffer);
86 RETURN_NULL_IF_NULL(texture_ref); 86 RETURN_NULL_IF_NULL(texture_ref);
87 gfx::GLImage* image = 87 gl::GLImage* image =
88 texture_ref->texture()->GetLevelImage(GetTextureTarget(), 0); 88 texture_ref->texture()->GetLevelImage(GetTextureTarget(), 0);
89 return static_cast<AVDACodecImage*>(image); 89 return static_cast<AVDACodecImage*>(image);
90 } 90 }
91 91
92 void AndroidDeferredRenderingBackingStrategy::SetImageForPicture( 92 void AndroidDeferredRenderingBackingStrategy::SetImageForPicture(
93 const media::PictureBuffer& picture_buffer, 93 const media::PictureBuffer& picture_buffer,
94 const scoped_refptr<gfx::GLImage>& image) { 94 const scoped_refptr<gl::GLImage>& image) {
95 gpu::gles2::TextureRef* texture_ref = GetTextureForPicture(picture_buffer); 95 gpu::gles2::TextureRef* texture_ref = GetTextureForPicture(picture_buffer);
96 RETURN_IF_NULL(texture_ref); 96 RETURN_IF_NULL(texture_ref);
97 97
98 gpu::gles2::TextureManager* texture_manager = 98 gpu::gles2::TextureManager* texture_manager =
99 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager(); 99 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager();
100 RETURN_IF_NULL(texture_manager); 100 RETURN_IF_NULL(texture_manager);
101 101
102 if (image) { 102 if (image) {
103 // Also set the parameters for the level if we're not clearing 103 // Also set the parameters for the level if we're not clearing
104 // the image. 104 // the image.
(...skipping 22 matching lines...) Expand all
127 // Note that this is not a race, since we do not re-use a PictureBuffer 127 // Note that this is not a race, since we do not re-use a PictureBuffer
128 // until after the CC is done drawing it. 128 // until after the CC is done drawing it.
129 avImage->SetMediaCodecBufferIndex(codec_buf_index); 129 avImage->SetMediaCodecBufferIndex(codec_buf_index);
130 avImage->SetSize(state_provider_->GetSize()); 130 avImage->SetSize(state_provider_->GetSize());
131 } 131 }
132 132
133 void AndroidDeferredRenderingBackingStrategy::AssignOnePictureBuffer( 133 void AndroidDeferredRenderingBackingStrategy::AssignOnePictureBuffer(
134 const media::PictureBuffer& picture_buffer) { 134 const media::PictureBuffer& picture_buffer) {
135 // Attach a GLImage to each texture that will use the surface texture. 135 // Attach a GLImage to each texture that will use the surface texture.
136 // We use a refptr here in case SetImageForPicture fails. 136 // We use a refptr here in case SetImageForPicture fails.
137 scoped_refptr<gfx::GLImage> gl_image( 137 scoped_refptr<gl::GLImage> gl_image(
138 new AVDACodecImage(shared_state_, media_codec_, 138 new AVDACodecImage(shared_state_, media_codec_,
139 state_provider_->GetGlDecoder(), surface_texture_)); 139 state_provider_->GetGlDecoder(), surface_texture_));
140 SetImageForPicture(picture_buffer, gl_image); 140 SetImageForPicture(picture_buffer, gl_image);
141 } 141 }
142 142
143 void AndroidDeferredRenderingBackingStrategy::ReleaseCodecBufferForPicture( 143 void AndroidDeferredRenderingBackingStrategy::ReleaseCodecBufferForPicture(
144 const media::PictureBuffer& picture_buffer) { 144 const media::PictureBuffer& picture_buffer) {
145 AVDACodecImage* avImage = GetImageForPicture(picture_buffer); 145 AVDACodecImage* avImage = GetImageForPicture(picture_buffer);
146 146
147 // See if there is a media codec buffer still attached to this image. 147 // See if there is a media codec buffer still attached to this image.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // doesn't know about them. 185 // doesn't know about them.
186 media_codec_ = codec; 186 media_codec_ = codec;
187 for (const std::pair<int, media::PictureBuffer>& entry : buffers) { 187 for (const std::pair<int, media::PictureBuffer>& entry : buffers) {
188 AVDACodecImage* avImage = GetImageForPicture(entry.second); 188 AVDACodecImage* avImage = GetImageForPicture(entry.second);
189 avImage->SetMediaCodec(codec); 189 avImage->SetMediaCodec(codec);
190 avImage->SetMediaCodecBufferIndex(-1); 190 avImage->SetMediaCodecBufferIndex(-1);
191 } 191 }
192 } 192 }
193 193
194 } // namespace content 194 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698