| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 313 |
| 313 // Holds a ref-count to the CDM. | 314 // Holds a ref-count to the CDM. |
| 314 scoped_refptr<media::MediaKeys> cdm_; | 315 scoped_refptr<media::MediaKeys> cdm_; |
| 315 | 316 |
| 316 // MediaDrmBridge requires registration/unregistration of the player, this | 317 // MediaDrmBridge requires registration/unregistration of the player, this |
| 317 // registration id is used for this. | 318 // registration id is used for this. |
| 318 int cdm_registration_id_; | 319 int cdm_registration_id_; |
| 319 | 320 |
| 320 // The MediaCrypto object is used in the MediaCodec.configure() in case of | 321 // The MediaCrypto object is used in the MediaCodec.configure() in case of |
| 321 // an encrypted stream. | 322 // an encrypted stream. |
| 322 media::MediaDrmBridge::JavaObjectPtr media_crypto_; | 323 media::MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto_; |
| 323 | 324 |
| 324 // Index of the dequeued and filled buffer that we keep trying to enqueue. | 325 // Index of the dequeued and filled buffer that we keep trying to enqueue. |
| 325 // Such buffer appears in MEDIA_CODEC_NO_KEY processing. | 326 // Such buffer appears in MEDIA_CODEC_NO_KEY processing. |
| 326 int pending_input_buf_index_; | 327 int pending_input_buf_index_; |
| 327 | 328 |
| 328 // Monotonically increasing value that is used to prevent old, delayed errors | 329 // Monotonically increasing value that is used to prevent old, delayed errors |
| 329 // from being sent after a reset. | 330 // from being sent after a reset. |
| 330 int error_sequence_token_; | 331 int error_sequence_token_; |
| 331 | 332 |
| 332 // PostError will defer sending an error if and only if this is true. | 333 // PostError will defer sending an error if and only if this is true. |
| 333 bool defer_errors_; | 334 bool defer_errors_; |
| 334 | 335 |
| 335 // WeakPtrFactory for posting tasks back to |this|. | 336 // WeakPtrFactory for posting tasks back to |this|. |
| 336 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 337 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| 337 | 338 |
| 338 friend class AndroidVideoDecodeAcceleratorTest; | 339 friend class AndroidVideoDecodeAcceleratorTest; |
| 339 }; | 340 }; |
| 340 | 341 |
| 341 } // namespace content | 342 } // namespace content |
| 342 | 343 |
| 343 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 344 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |