Chromium Code Reviews| 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/avda_codec_image.h" | 5 #include "content/common/gpu/media/avda_codec_image.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 surface_texture_(surface_texture), | 32 surface_texture_(surface_texture), |
| 33 detach_surface_texture_on_destruction_(false), | 33 detach_surface_texture_on_destruction_(false), |
| 34 texture_(0) { | 34 texture_(0) { |
| 35 // Default to a sane guess of "flip Y", just in case we can't get | 35 // Default to a sane guess of "flip Y", just in case we can't get |
| 36 // the matrix on the first call. | 36 // the matrix on the first call. |
| 37 memset(gl_matrix_, 0, sizeof(gl_matrix_)); | 37 memset(gl_matrix_, 0, sizeof(gl_matrix_)); |
| 38 gl_matrix_[0] = gl_matrix_[10] = gl_matrix_[15] = 1.0f; | 38 gl_matrix_[0] = gl_matrix_[10] = gl_matrix_[15] = 1.0f; |
| 39 gl_matrix_[5] = -1.0f; | 39 gl_matrix_[5] = -1.0f; |
| 40 } | 40 } |
| 41 | 41 |
| 42 AVDACodecImage::~AVDACodecImage() {} | 42 AVDACodecImage::~AVDACodecImage() { |
| 43 shared_state_->EraseImage(this); | |
| 44 } | |
| 43 | 45 |
| 44 void AVDACodecImage::Destroy(bool have_context) {} | 46 void AVDACodecImage::Destroy(bool have_context) {} |
| 45 | 47 |
| 46 gfx::Size AVDACodecImage::GetSize() { | 48 gfx::Size AVDACodecImage::GetSize() { |
| 47 return size_; | 49 return size_; |
| 48 } | 50 } |
| 49 | 51 |
| 50 unsigned AVDACodecImage::GetInternalFormat() { | 52 unsigned AVDACodecImage::GetInternalFormat() { |
| 51 return GL_RGBA; | 53 return GL_RGBA; |
| 52 } | 54 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 } | 167 } |
| 166 | 168 |
| 167 int AVDACodecImage::GetMediaCodecBufferIndex() const { | 169 int AVDACodecImage::GetMediaCodecBufferIndex() const { |
| 168 return codec_buffer_index_; | 170 return codec_buffer_index_; |
| 169 } | 171 } |
| 170 | 172 |
| 171 void AVDACodecImage::SetSize(const gfx::Size& size) { | 173 void AVDACodecImage::SetSize(const gfx::Size& size) { |
| 172 size_ = size; | 174 size_ = size; |
| 173 } | 175 } |
| 174 | 176 |
| 175 void AVDACodecImage::SetMediaCodec(media::MediaCodecBridge* codec) { | 177 void AVDACodecImage::SetMediaCodec(media::MediaCodecBridge* codec) { |
|
liberato (no reviews please)
2016/04/21 23:39:54
maybe rename to CodecChanged, since it also resets
DaleCurtis
2016/04/22 00:11:19
Done.
| |
| 176 media_codec_ = codec; | 178 media_codec_ = codec; |
| 179 codec_buffer_index_ = -1; | |
|
watk
2016/04/21 20:45:01
kInvalidCodecBufferIndex?
DaleCurtis
2016/04/22 00:11:21
Done.
| |
| 177 } | 180 } |
| 178 | 181 |
| 179 void AVDACodecImage::SetTexture(gpu::gles2::Texture* texture) { | 182 void AVDACodecImage::SetTexture(gpu::gles2::Texture* texture) { |
| 180 texture_ = texture; | 183 texture_ = texture; |
| 181 } | 184 } |
| 182 | 185 |
| 183 void AVDACodecImage::AttachSurfaceTextureToContext() { | 186 void AVDACodecImage::AttachSurfaceTextureToContext() { |
| 184 DCHECK(surface_texture_); | 187 DCHECK(surface_texture_); |
| 185 | 188 |
| 186 // We assume that the currently bound texture is the intended one. | 189 // We assume that the currently bound texture is the intended one. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 } | 237 } |
| 235 | 238 |
| 236 memcpy(matrix, gl_matrix_, sizeof(gl_matrix_)); | 239 memcpy(matrix, gl_matrix_, sizeof(gl_matrix_)); |
| 237 } | 240 } |
| 238 | 241 |
| 239 bool AVDACodecImage::IsCodecBufferOutstanding() const { | 242 bool AVDACodecImage::IsCodecBufferOutstanding() const { |
| 240 return codec_buffer_index_ != kInvalidCodecBufferIndex && media_codec_; | 243 return codec_buffer_index_ != kInvalidCodecBufferIndex && media_codec_; |
| 241 } | 244 } |
| 242 | 245 |
| 243 } // namespace content | 246 } // namespace content |
| OLD | NEW |