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

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

Issue 1939683002: Test X11 header pollution (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 "content/common/gpu/media/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 "content/common/gpu/media/avda_return_on_failure.h"
11 #include "gpu/command_buffer/service/context_group.h" 10 #include "gpu/command_buffer/service/context_group.h"
12 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" 11 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 12 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
14 #include "media/base/limits.h" 13 #include "media/base/limits.h"
14 #include "media/gpu/avda_return_on_failure.h"
15 #include "media/video/picture.h" 15 #include "media/video/picture.h"
16 #include "ui/gl/android/surface_texture.h" 16 #include "ui/gl/android/surface_texture.h"
17 #include "ui/gl/gl_bindings.h" 17 #include "ui/gl/gl_bindings.h"
18 18
19 namespace content { 19 namespace media {
20 20
21 AndroidCopyingBackingStrategy::AndroidCopyingBackingStrategy( 21 AndroidCopyingBackingStrategy::AndroidCopyingBackingStrategy(
22 AVDAStateProvider* state_provider) 22 AVDAStateProvider* state_provider)
23 : state_provider_(state_provider), 23 : state_provider_(state_provider),
24 surface_texture_id_(0), 24 surface_texture_id_(0),
25 media_codec_(nullptr) {} 25 media_codec_(nullptr) {}
26 26
27 AndroidCopyingBackingStrategy::~AndroidCopyingBackingStrategy() {} 27 AndroidCopyingBackingStrategy::~AndroidCopyingBackingStrategy() {}
28 28
29 gfx::ScopedJavaSurface AndroidCopyingBackingStrategy::Initialize( 29 gfx::ScopedJavaSurface AndroidCopyingBackingStrategy::Initialize(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 surface_texture_->GetTransformMatrix(transform_matrix); 118 surface_texture_->GetTransformMatrix(transform_matrix);
119 119
120 DCHECK_LE(1u, picture_buffer.texture_ids().size()); 120 DCHECK_LE(1u, picture_buffer.texture_ids().size());
121 uint32_t picture_buffer_texture_id = picture_buffer.texture_ids()[0]; 121 uint32_t picture_buffer_texture_id = picture_buffer.texture_ids()[0];
122 122
123 // Defer initializing the CopyTextureCHROMIUMResourceManager until it is 123 // Defer initializing the CopyTextureCHROMIUMResourceManager until it is
124 // needed because it takes 10s of milliseconds to initialize. 124 // needed because it takes 10s of milliseconds to initialize.
125 if (!copier_) { 125 if (!copier_) {
126 copier_.reset(new gpu::CopyTextureCHROMIUMResourceManager()); 126 copier_.reset(new gpu::CopyTextureCHROMIUMResourceManager());
127 copier_->Initialize(state_provider_->GetGlDecoder().get(), 127 copier_->Initialize(state_provider_->GetGlDecoder().get(),
128 state_provider_->GetGlDecoder()->GetContextGroup()-> 128 state_provider_->GetGlDecoder()
129 feature_info()->feature_flags()); 129 ->GetContextGroup()
130 ->feature_info()
131 ->feature_flags());
130 } 132 }
131 133
132 // Here, we copy |surface_texture_id_| to the picture buffer instead of 134 // Here, we copy |surface_texture_id_| to the picture buffer instead of
133 // setting new texture to |surface_texture_| by calling attachToGLContext() 135 // setting new texture to |surface_texture_| by calling attachToGLContext()
134 // because: 136 // because:
135 // 1. Once we call detachFrameGLContext(), it deletes the texture previously 137 // 1. Once we call detachFrameGLContext(), it deletes the texture previously
136 // attached. 138 // attached.
137 // 2. SurfaceTexture requires us to apply a transform matrix when we show 139 // 2. SurfaceTexture requires us to apply a transform matrix when we show
138 // the texture. 140 // the texture.
139 copier_->DoCopyTextureWithTransform( 141 copier_->DoCopyTextureWithTransform(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 state_provider_->GetTextureForPicture(*picture_buffer); 183 state_provider_->GetTextureForPicture(*picture_buffer);
182 RETURN_IF_NULL(texture_ref); 184 RETURN_IF_NULL(texture_ref);
183 gpu::gles2::TextureManager* texture_manager = 185 gpu::gles2::TextureManager* texture_manager =
184 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager(); 186 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager();
185 RETURN_IF_NULL(texture_manager); 187 RETURN_IF_NULL(texture_manager);
186 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA, 188 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA,
187 new_size.width(), new_size.height(), 1, 0, 189 new_size.width(), new_size.height(), 1, 0,
188 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(new_size)); 190 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(new_size));
189 } 191 }
190 192
191 } // namespace content 193 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/android_copying_backing_strategy.h ('k') | media/gpu/android_deferred_rendering_backing_strategy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698