| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 state_provider_->GetGlDecoder()->RestoreTextureUnitBindings(0); | 49 state_provider_->GetGlDecoder()->RestoreTextureUnitBindings(0); |
| 50 state_provider_->GetGlDecoder()->RestoreActiveTexture(); | 50 state_provider_->GetGlDecoder()->RestoreActiveTexture(); |
| 51 | 51 |
| 52 surface_texture_ = gfx::SurfaceTexture::Create(surface_texture_id_); | 52 surface_texture_ = gfx::SurfaceTexture::Create(surface_texture_id_); |
| 53 | 53 |
| 54 return gfx::ScopedJavaSurface(surface_texture_.get()); | 54 return gfx::ScopedJavaSurface(surface_texture_.get()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void AndroidCopyingBackingStrategy::Cleanup( | 57 void AndroidCopyingBackingStrategy::Cleanup( |
| 58 bool have_context, | 58 bool have_context, |
| 59 const AndroidVideoDecodeAccelerator::OutputBufferMap&) { | 59 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) { |
| 60 DCHECK(state_provider_->ThreadChecker().CalledOnValidThread()); | 60 DCHECK(state_provider_->ThreadChecker().CalledOnValidThread()); |
| 61 | 61 |
| 62 if (copier_) | 62 if (copier_) |
| 63 copier_->Destroy(); | 63 copier_->Destroy(); |
| 64 | 64 |
| 65 if (surface_texture_id_ && have_context) | 65 if (surface_texture_id_ && have_context) |
| 66 glDeleteTextures(1, &surface_texture_id_); | 66 glDeleteTextures(1, &surface_texture_id_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 scoped_refptr<gfx::SurfaceTexture> | 69 scoped_refptr<gfx::SurfaceTexture> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // 2. SurfaceTexture requires us to apply a transform matrix when we show | 137 // 2. SurfaceTexture requires us to apply a transform matrix when we show |
| 138 // the texture. | 138 // the texture. |
| 139 copier_->DoCopyTextureWithTransform( | 139 copier_->DoCopyTextureWithTransform( |
| 140 state_provider_->GetGlDecoder().get(), GL_TEXTURE_EXTERNAL_OES, | 140 state_provider_->GetGlDecoder().get(), GL_TEXTURE_EXTERNAL_OES, |
| 141 surface_texture_id_, GL_TEXTURE_2D, picture_buffer_texture_id, | 141 surface_texture_id_, GL_TEXTURE_2D, picture_buffer_texture_id, |
| 142 state_provider_->GetSize().width(), state_provider_->GetSize().height(), | 142 state_provider_->GetSize().width(), state_provider_->GetSize().height(), |
| 143 true, false, false, transform_matrix); | 143 true, false, false, transform_matrix); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void AndroidCopyingBackingStrategy::CodecChanged( | 146 void AndroidCopyingBackingStrategy::CodecChanged( |
| 147 media::VideoCodecBridge* codec, | 147 media::VideoCodecBridge* codec) { |
| 148 const AndroidVideoDecodeAccelerator::OutputBufferMap&) { | |
| 149 media_codec_ = codec; | 148 media_codec_ = codec; |
| 150 } | 149 } |
| 151 | 150 |
| 152 void AndroidCopyingBackingStrategy::OnFrameAvailable() { | 151 void AndroidCopyingBackingStrategy::OnFrameAvailable() { |
| 153 // TODO(liberato): crbug.com/574948 . The OnFrameAvailable logic can be | 152 // TODO(liberato): crbug.com/574948 . The OnFrameAvailable logic can be |
| 154 // moved into AVDA, and we should wait for it before doing the copy. | 153 // moved into AVDA, and we should wait for it before doing the copy. |
| 155 // Because there were some test failures, we don't do this now but | 154 // Because there were some test failures, we don't do this now but |
| 156 // instead preserve the old behavior. | 155 // instead preserve the old behavior. |
| 157 } | 156 } |
| 158 | 157 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 183 RETURN_IF_NULL(texture_ref); | 182 RETURN_IF_NULL(texture_ref); |
| 184 gpu::gles2::TextureManager* texture_manager = | 183 gpu::gles2::TextureManager* texture_manager = |
| 185 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager(); | 184 state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager(); |
| 186 RETURN_IF_NULL(texture_manager); | 185 RETURN_IF_NULL(texture_manager); |
| 187 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA, | 186 texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA, |
| 188 new_size.width(), new_size.height(), 1, 0, | 187 new_size.width(), new_size.height(), 1, 0, |
| 189 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(new_size)); | 188 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(new_size)); |
| 190 } | 189 } |
| 191 | 190 |
| 192 } // namespace content | 191 } // namespace content |
| OLD | NEW |