| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <queue> | 12 #include <queue> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/common/gpu/media/avda_state_provider.h" | 20 #include "content/common/gpu/media/avda_state_provider.h" |
| 21 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 21 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 22 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 22 #include "media/base/android/media_drm_bridge_cdm_context.h" | 23 #include "media/base/android/media_drm_bridge_cdm_context.h" |
| 23 #include "media/base/android/sdk_media_codec_bridge.h" | 24 #include "media/base/android/sdk_media_codec_bridge.h" |
| 24 #include "media/base/media_keys.h" | 25 #include "media/base/media_keys.h" |
| 25 #include "media/video/video_decode_accelerator.h" | 26 #include "media/video/video_decode_accelerator.h" |
| 26 #include "ui/gl/android/scoped_java_surface.h" | 27 #include "ui/gl/android/scoped_java_surface.h" |
| 27 | 28 |
| 28 namespace gfx { | 29 namespace gfx { |
| 29 class SurfaceTexture; | 30 class SurfaceTexture; |
| 30 } | 31 } |
| 31 | 32 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 129 |
| 129 // AVDAStateProvider implementation: | 130 // AVDAStateProvider implementation: |
| 130 const gfx::Size& GetSize() const override; | 131 const gfx::Size& GetSize() const override; |
| 131 const base::ThreadChecker& ThreadChecker() const override; | 132 const base::ThreadChecker& ThreadChecker() const override; |
| 132 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override; | 133 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override; |
| 133 gpu::gles2::TextureRef* GetTextureForPicture( | 134 gpu::gles2::TextureRef* GetTextureForPicture( |
| 134 const media::PictureBuffer& picture_buffer) override; | 135 const media::PictureBuffer& picture_buffer) override; |
| 135 void PostError(const ::tracked_objects::Location& from_here, | 136 void PostError(const ::tracked_objects::Location& from_here, |
| 136 media::VideoDecodeAccelerator::Error error) override; | 137 media::VideoDecodeAccelerator::Error error) override; |
| 137 | 138 |
| 138 static media::VideoDecodeAccelerator::Capabilities GetCapabilities(); | 139 static media::VideoDecodeAccelerator::Capabilities GetCapabilities( |
| 140 const gpu::GpuPreferences& gpu_preferences); |
| 139 | 141 |
| 140 // Notifies about SurfaceTexture::OnFrameAvailable. This can happen on any | 142 // Notifies about SurfaceTexture::OnFrameAvailable. This can happen on any |
| 141 // thread at any time! | 143 // thread at any time! |
| 142 void OnFrameAvailable(); | 144 void OnFrameAvailable(); |
| 143 | 145 |
| 144 private: | 146 private: |
| 145 friend class AVDATimerManager; | 147 friend class AVDATimerManager; |
| 146 | 148 |
| 147 // TODO(timav): evaluate the need for more states in the AVDA state machine. | 149 // TODO(timav): evaluate the need for more states in the AVDA state machine. |
| 148 enum State { | 150 enum State { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // components need to be reset upon EOS to decode a later stream. Input state | 224 // components need to be reset upon EOS to decode a later stream. Input state |
| 223 // (e.g. queued BitstreamBuffers) is not reset, as input following an EOS | 225 // (e.g. queued BitstreamBuffers) is not reset, as input following an EOS |
| 224 // is still valid and should be processed. | 226 // is still valid and should be processed. |
| 225 void ResetCodecState(); | 227 void ResetCodecState(); |
| 226 | 228 |
| 227 // Dismiss all |output_picture_buffers_| in preparation for requesting new | 229 // Dismiss all |output_picture_buffers_| in preparation for requesting new |
| 228 // ones. | 230 // ones. |
| 229 void DismissPictureBuffers(); | 231 void DismissPictureBuffers(); |
| 230 | 232 |
| 231 // Return true if and only if we should use deferred rendering. | 233 // Return true if and only if we should use deferred rendering. |
| 232 static bool UseDeferredRenderingStrategy(); | 234 static bool UseDeferredRenderingStrategy( |
| 235 const gpu::GpuPreferences& gpu_preferences); |
| 233 | 236 |
| 234 // Used to DCHECK that we are called on the correct thread. | 237 // Used to DCHECK that we are called on the correct thread. |
| 235 base::ThreadChecker thread_checker_; | 238 base::ThreadChecker thread_checker_; |
| 236 | 239 |
| 237 // To expose client callbacks from VideoDecodeAccelerator. | 240 // To expose client callbacks from VideoDecodeAccelerator. |
| 238 Client* client_; | 241 Client* client_; |
| 239 | 242 |
| 240 // Callback to set the correct gl context. | 243 // Callback to set the correct gl context. |
| 241 base::Callback<bool(void)> make_context_current_; | 244 base::Callback<bool(void)> make_context_current_; |
| 242 | 245 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 340 |
| 338 // WeakPtrFactory for posting tasks back to |this|. | 341 // WeakPtrFactory for posting tasks back to |this|. |
| 339 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 342 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| 340 | 343 |
| 341 friend class AndroidVideoDecodeAcceleratorTest; | 344 friend class AndroidVideoDecodeAcceleratorTest; |
| 342 }; | 345 }; |
| 343 | 346 |
| 344 } // namespace content | 347 } // namespace content |
| 345 | 348 |
| 346 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 349 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |