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/android_deferred_rendering_backing_strategy.h " | 5 #include "content/common/gpu/media/android_deferred_rendering_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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "content/common/gpu/gpu_channel.h" | 11 #include "content/common/gpu/gpu_channel.h" |
| 12 #include "content/common/gpu/media/avda_codec_image.h" | 12 #include "content/common/gpu/media/avda_codec_image.h" |
| 13 #include "content/common/gpu/media/avda_return_on_failure.h" | 13 #include "content/common/gpu/media/avda_return_on_failure.h" |
| 14 #include "content/common/gpu/media/avda_shared_state.h" | 14 #include "content/common/gpu/media/avda_shared_state.h" |
| 15 #include "gpu/command_buffer/service/texture_manager.h" | 15 #include "gpu/command_buffer/service/texture_manager.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 content { |
| 20 | 20 |
| 21 // TODO(liberato): This is an entirely made-up number. It depends on how | 21 // This is the maximum number of pictures that we will allow to be outstanding |
| 22 // many decoded buffers that the MediaCodec is willing to have outstanding | 22 // at once. We might not be able to support this many in all circumstances, |
| 23 // at any one time. Only one is guaranteed. crbug.com/531606. | 23 // depending on how many decoded buffers the MediaCodec is willing to |
| 24 enum { kNumPictureBuffers = 3 }; | 24 // give us. Only one is guaranteed. However, we also indicate in our |
| 25 // capabilities that we make no guarantees about it, so this is okay. | |
| 26 enum { kNumPictureBuffers = 4 }; | |
|
DaleCurtis
2015/12/04 18:40:13
Should this be limits:kMaxFrames + 1 like in the c
liberato (no reviews please)
2015/12/04 18:50:04
done, and removed GetNumPictureBuffers.
| |
| 25 | 27 |
| 26 AndroidDeferredRenderingBackingStrategy:: | 28 AndroidDeferredRenderingBackingStrategy:: |
| 27 AndroidDeferredRenderingBackingStrategy() | 29 AndroidDeferredRenderingBackingStrategy() |
| 28 : state_provider_(nullptr), media_codec_(nullptr) {} | 30 : state_provider_(nullptr), media_codec_(nullptr) {} |
| 29 | 31 |
| 30 AndroidDeferredRenderingBackingStrategy:: | 32 AndroidDeferredRenderingBackingStrategy:: |
| 31 ~AndroidDeferredRenderingBackingStrategy() {} | 33 ~AndroidDeferredRenderingBackingStrategy() {} |
| 32 | 34 |
| 33 void AndroidDeferredRenderingBackingStrategy::Initialize( | 35 void AndroidDeferredRenderingBackingStrategy::Initialize( |
| 34 AVDAStateProvider* state_provider) { | 36 AVDAStateProvider* state_provider) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 // doesn't know about them. | 189 // doesn't know about them. |
| 188 media_codec_ = codec; | 190 media_codec_ = codec; |
| 189 for (const std::pair<int, media::PictureBuffer>& entry : buffers) { | 191 for (const std::pair<int, media::PictureBuffer>& entry : buffers) { |
| 190 AVDACodecImage* avImage = GetImageForPicture(entry.second); | 192 AVDACodecImage* avImage = GetImageForPicture(entry.second); |
| 191 avImage->SetMediaCodec(codec); | 193 avImage->SetMediaCodec(codec); |
| 192 avImage->SetMediaCodecBufferIndex(-1); | 194 avImage->SetMediaCodecBufferIndex(-1); |
| 193 } | 195 } |
| 194 } | 196 } |
| 195 | 197 |
| 196 } // namespace content | 198 } // namespace content |
| OLD | NEW |