| 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 "media/base/android/media_drm_bridge.h" | 22 #include "media/base/android/media_drm_bridge_cdm_context.h" |
| 23 #include "media/base/android/sdk_media_codec_bridge.h" | 23 #include "media/base/android/sdk_media_codec_bridge.h" |
| 24 #include "media/base/media_keys.h" | 24 #include "media/base/media_keys.h" |
| 25 #include "media/video/video_decode_accelerator.h" | 25 #include "media/video/video_decode_accelerator.h" |
| 26 #include "ui/gl/android/scoped_java_surface.h" | 26 #include "ui/gl/android/scoped_java_surface.h" |
| 27 | 27 |
| 28 namespace gfx { | 28 namespace gfx { |
| 29 class SurfaceTexture; | 29 class SurfaceTexture; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 bool DequeueOutput(); | 175 bool DequeueOutput(); |
| 176 | 176 |
| 177 // Requests picture buffers from the client. | 177 // Requests picture buffers from the client. |
| 178 void RequestPictureBuffers(); | 178 void RequestPictureBuffers(); |
| 179 | 179 |
| 180 // Decode the content in the |bitstream_buffer|. Note that a | 180 // Decode the content in the |bitstream_buffer|. Note that a |
| 181 // |bitstream_buffer| of id as -1 indicates a flush command. | 181 // |bitstream_buffer| of id as -1 indicates a flush command. |
| 182 void DecodeBuffer(const media::BitstreamBuffer& bitstream_buffer); | 182 void DecodeBuffer(const media::BitstreamBuffer& bitstream_buffer); |
| 183 | 183 |
| 184 // This callback is called after CDM obtained a MediaCrypto object. | 184 // This callback is called after CDM obtained a MediaCrypto object. |
| 185 void OnMediaCryptoReady(media::MediaDrmBridge::JavaObjectPtr media_crypto, | 185 void OnMediaCryptoReady( |
| 186 bool needs_protected_surface); | 186 media::MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto, |
| 187 bool needs_protected_surface); |
| 187 | 188 |
| 188 // This callback is called when a new key is added to CDM. | 189 // This callback is called when a new key is added to CDM. |
| 189 void OnKeyAdded(); | 190 void OnKeyAdded(); |
| 190 | 191 |
| 191 // Notifies the client of the CDM setting result. | 192 // Notifies the client of the CDM setting result. |
| 192 void NotifyCdmAttached(bool success); | 193 void NotifyCdmAttached(bool success); |
| 193 | 194 |
| 194 // Notifies the client about the availability of a picture. | 195 // Notifies the client about the availability of a picture. |
| 195 void NotifyPictureReady(const media::Picture& picture); | 196 void NotifyPictureReady(const media::Picture& picture); |
| 196 | 197 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 304 |
| 304 // Helper class that manages asynchronous OnFrameAvailable callbacks. | 305 // Helper class that manages asynchronous OnFrameAvailable callbacks. |
| 305 class OnFrameAvailableHandler; | 306 class OnFrameAvailableHandler; |
| 306 scoped_refptr<OnFrameAvailableHandler> on_frame_available_handler_; | 307 scoped_refptr<OnFrameAvailableHandler> on_frame_available_handler_; |
| 307 | 308 |
| 308 // Time at which we last did useful work on io_timer_. | 309 // Time at which we last did useful work on io_timer_. |
| 309 base::TimeTicks most_recent_work_; | 310 base::TimeTicks most_recent_work_; |
| 310 | 311 |
| 311 // CDM related stuff. | 312 // CDM related stuff. |
| 312 | 313 |
| 313 // Holds a ref-count to the CDM. | 314 // Holds a ref-count to the CDM to avoid using the CDM after it's destroyed. |
| 314 scoped_refptr<media::MediaKeys> cdm_; | 315 scoped_refptr<media::MediaKeys> cdm_for_reference_holding_only_; |
| 316 |
| 317 media::MediaDrmBridgeCdmContext* media_drm_bridge_cdm_context_; |
| 315 | 318 |
| 316 // MediaDrmBridge requires registration/unregistration of the player, this | 319 // MediaDrmBridge requires registration/unregistration of the player, this |
| 317 // registration id is used for this. | 320 // registration id is used for this. |
| 318 int cdm_registration_id_; | 321 int cdm_registration_id_; |
| 319 | 322 |
| 320 // The MediaCrypto object is used in the MediaCodec.configure() in case of | 323 // The MediaCrypto object is used in the MediaCodec.configure() in case of |
| 321 // an encrypted stream. | 324 // an encrypted stream. |
| 322 media::MediaDrmBridge::JavaObjectPtr media_crypto_; | 325 media::MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto_; |
| 323 | 326 |
| 324 // Index of the dequeued and filled buffer that we keep trying to enqueue. | 327 // Index of the dequeued and filled buffer that we keep trying to enqueue. |
| 325 // Such buffer appears in MEDIA_CODEC_NO_KEY processing. | 328 // Such buffer appears in MEDIA_CODEC_NO_KEY processing. |
| 326 int pending_input_buf_index_; | 329 int pending_input_buf_index_; |
| 327 | 330 |
| 328 // Monotonically increasing value that is used to prevent old, delayed errors | 331 // Monotonically increasing value that is used to prevent old, delayed errors |
| 329 // from being sent after a reset. | 332 // from being sent after a reset. |
| 330 int error_sequence_token_; | 333 int error_sequence_token_; |
| 331 | 334 |
| 332 // PostError will defer sending an error if and only if this is true. | 335 // PostError will defer sending an error if and only if this is true. |
| 333 bool defer_errors_; | 336 bool defer_errors_; |
| 334 | 337 |
| 335 // WeakPtrFactory for posting tasks back to |this|. | 338 // WeakPtrFactory for posting tasks back to |this|. |
| 336 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 339 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| 337 | 340 |
| 338 friend class AndroidVideoDecodeAcceleratorTest; | 341 friend class AndroidVideoDecodeAcceleratorTest; |
| 339 }; | 342 }; |
| 340 | 343 |
| 341 } // namespace content | 344 } // namespace content |
| 342 | 345 |
| 343 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 346 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |