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 "content/common/gpu/media/android_copying_backing_strategy.h" | 5 #include "content/common/gpu/media/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" | 10 #include "content/common/gpu/media/avda_return_on_failure.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 scoped_refptr<gfx::SurfaceTexture> | 69 scoped_refptr<gfx::SurfaceTexture> |
70 AndroidCopyingBackingStrategy::GetSurfaceTexture() const { | 70 AndroidCopyingBackingStrategy::GetSurfaceTexture() const { |
71 return surface_texture_; | 71 return surface_texture_; |
72 } | 72 } |
73 | 73 |
74 uint32_t AndroidCopyingBackingStrategy::GetTextureTarget() const { | 74 uint32_t AndroidCopyingBackingStrategy::GetTextureTarget() const { |
75 return GL_TEXTURE_2D; | 75 return GL_TEXTURE_2D; |
76 } | 76 } |
77 | 77 |
| 78 gfx::Size AndroidCopyingBackingStrategy::GetPictureBufferSize() const { |
| 79 return state_provider_->GetSize(); |
| 80 } |
| 81 |
78 void AndroidCopyingBackingStrategy::UseCodecBufferForPictureBuffer( | 82 void AndroidCopyingBackingStrategy::UseCodecBufferForPictureBuffer( |
79 int32_t codec_buf_index, | 83 int32_t codec_buf_index, |
80 const media::PictureBuffer& picture_buffer) { | 84 const media::PictureBuffer& picture_buffer) { |
81 // Make sure that the decoder is available. | 85 // Make sure that the decoder is available. |
82 RETURN_ON_FAILURE(state_provider_, state_provider_->GetGlDecoder().get(), | 86 RETURN_ON_FAILURE(state_provider_, state_provider_->GetGlDecoder().get(), |
83 "Failed to get gles2 decoder instance.", ILLEGAL_STATE); | 87 "Failed to get gles2 decoder instance.", ILLEGAL_STATE); |
84 | 88 |
85 // Render the codec buffer into |surface_texture_|, and switch it to be | 89 // Render the codec buffer into |surface_texture_|, and switch it to be |
86 // the front buffer. | 90 // the front buffer. |
87 // This ignores the emitted ByteBuffer and instead relies on rendering to | 91 // This ignores the emitted ByteBuffer and instead relies on rendering to |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 RETURN_IF_NULL(texture_ref); | 181 RETURN_IF_NULL(texture_ref); |
178 gpu::gles2::TextureManager* texture_manager = | 182 gpu::gles2::TextureManager* texture_manager = |
179 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager(); | 183 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager(); |
180 RETURN_IF_NULL(texture_manager); | 184 RETURN_IF_NULL(texture_manager); |
181 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA, | 185 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA, |
182 new_size.width(), new_size.height(), 1, 0, | 186 new_size.width(), new_size.height(), 1, 0, |
183 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(new_size)); | 187 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(new_size)); |
184 } | 188 } |
185 | 189 |
186 } // namespace content | 190 } // namespace content |
OLD | NEW |