| 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 "media/gpu/avda_shared_state.h" | 5 #include "media/gpu/avda_shared_state.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "media/gpu/avda_codec_image.h" | 9 #include "media/gpu/avda_codec_image.h" |
| 10 #include "ui/gl/android/surface_texture.h" | 10 #include "ui/gl/android/surface_texture.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 void AVDASharedState::SetSurfaceTexture( | 73 void AVDASharedState::SetSurfaceTexture( |
| 74 scoped_refptr<gl::SurfaceTexture> surface_texture, | 74 scoped_refptr<gl::SurfaceTexture> surface_texture, |
| 75 GLuint attached_service_id) { | 75 GLuint attached_service_id) { |
| 76 surface_texture_ = surface_texture; | 76 surface_texture_ = surface_texture; |
| 77 surface_texture_service_id_ = attached_service_id; | 77 surface_texture_service_id_ = attached_service_id; |
| 78 context_ = gl::GLContext::GetCurrent(); | 78 context_ = gl::GLContext::GetCurrent(); |
| 79 surface_ = gl::GLSurface::GetCurrent(); | 79 surface_ = gl::GLSurface::GetCurrent(); |
| 80 DCHECK(context_); | |
| 81 DCHECK(surface_); | |
| 82 } | 80 } |
| 83 | 81 |
| 84 void AVDASharedState::CodecChanged(MediaCodecBridge* codec) { | 82 void AVDASharedState::CodecChanged(MediaCodecBridge* codec) { |
| 85 for (auto& image_kv : codec_images_) | 83 for (auto& image_kv : codec_images_) |
| 86 image_kv.second->CodecChanged(codec); | 84 image_kv.second->CodecChanged(codec); |
| 87 release_time_ = base::TimeTicks(); | 85 release_time_ = base::TimeTicks(); |
| 88 } | 86 } |
| 89 | 87 |
| 90 void AVDASharedState::SetImageForPicture(int picture_buffer_id, | 88 void AVDASharedState::SetImageForPicture(int picture_buffer_id, |
| 91 AVDACodecImage* image) { | 89 AVDACodecImage* image) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 118 surface_texture_->UpdateTexImage(); | 116 surface_texture_->UpdateTexImage(); |
| 119 // Helpfully, this is already column major. | 117 // Helpfully, this is already column major. |
| 120 surface_texture_->GetTransformMatrix(gl_matrix_); | 118 surface_texture_->GetTransformMatrix(gl_matrix_); |
| 121 } | 119 } |
| 122 | 120 |
| 123 void AVDASharedState::GetTransformMatrix(float matrix[16]) const { | 121 void AVDASharedState::GetTransformMatrix(float matrix[16]) const { |
| 124 memcpy(matrix, gl_matrix_, sizeof(gl_matrix_)); | 122 memcpy(matrix, gl_matrix_, sizeof(gl_matrix_)); |
| 125 } | 123 } |
| 126 | 124 |
| 127 } // namespace media | 125 } // namespace media |
| OLD | NEW |