| 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 MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 gfx::Size initial_expected_coded_size_; | 203 gfx::Size initial_expected_coded_size_; |
| 204 | 204 |
| 205 protected: | 205 protected: |
| 206 friend class base::RefCountedThreadSafe<CodecConfig>; | 206 friend class base::RefCountedThreadSafe<CodecConfig>; |
| 207 virtual ~CodecConfig(); | 207 virtual ~CodecConfig(); |
| 208 | 208 |
| 209 private: | 209 private: |
| 210 DISALLOW_COPY_AND_ASSIGN(CodecConfig); | 210 DISALLOW_COPY_AND_ASSIGN(CodecConfig); |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 // Callback that is called when the SurfaceView becomes available, if it's |
| 214 // not during Initialize. |success| is true if it is now available, false |
| 215 // if initialization should stop. |
| 216 void OnSurfaceAvailable(bool success); |
| 217 |
| 218 // Finish initialization of the strategy. This is to be called when the |
| 219 // SurfaceView in |surface_id_|, if any, is no longer busy. It will return |
| 220 // false on failure, and true if initialization was successful. This includes |
| 221 // synchronous and asynchronous init; the AVDA might not yet have a codec on |
| 222 // success, but async init will at least be in progress. |
| 223 bool InitializeStrategy(); |
| 224 |
| 213 // A part of destruction process that is sometimes postponed after the drain. | 225 // A part of destruction process that is sometimes postponed after the drain. |
| 214 void ActualDestroy(); | 226 void ActualDestroy(); |
| 215 | 227 |
| 216 // Configures |media_codec_| with the given codec parameters from the client. | 228 // Configures |media_codec_| with the given codec parameters from the client. |
| 217 // This configuration will (probably) not be complete before this call | 229 // This configuration will (probably) not be complete before this call |
| 218 // returns. Multiple calls before completion will be ignored. |state_| | 230 // returns. Multiple calls before completion will be ignored. |state_| |
| 219 // must be NO_ERROR or WAITING_FOR_CODEC. Note that, once you call this, | 231 // must be NO_ERROR or WAITING_FOR_CODEC. Note that, once you call this, |
| 220 // you should be careful to avoid modifying members of |codec_config_| until | 232 // you should be careful to avoid modifying members of |codec_config_| until |
| 221 // |state_| is no longer WAITING_FOR_CODEC. | 233 // |state_| is no longer WAITING_FOR_CODEC. |
| 222 void ConfigureMediaCodecAsynchronously(); | 234 void ConfigureMediaCodecAsynchronously(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 bool DequeueOutput(); | 268 bool DequeueOutput(); |
| 257 | 269 |
| 258 // Requests picture buffers from the client. | 270 // Requests picture buffers from the client. |
| 259 void RequestPictureBuffers(); | 271 void RequestPictureBuffers(); |
| 260 | 272 |
| 261 // Decode the content in the |bitstream_buffer|. Note that a | 273 // Decode the content in the |bitstream_buffer|. Note that a |
| 262 // |bitstream_buffer| of id as -1 indicates a flush command. | 274 // |bitstream_buffer| of id as -1 indicates a flush command. |
| 263 void DecodeBuffer(const media::BitstreamBuffer& bitstream_buffer); | 275 void DecodeBuffer(const media::BitstreamBuffer& bitstream_buffer); |
| 264 | 276 |
| 265 // Called during Initialize() for encrypted streams to set up the CDM. | 277 // Called during Initialize() for encrypted streams to set up the CDM. |
| 266 void InitializeCdm(int cdm_id); | 278 void InitializeCdm(); |
| 267 | 279 |
| 268 // Called after the CDM obtains a MediaCrypto object. | 280 // Called after the CDM obtains a MediaCrypto object. |
| 269 void OnMediaCryptoReady( | 281 void OnMediaCryptoReady( |
| 270 media::MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto, | 282 media::MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto, |
| 271 bool needs_protected_surface); | 283 bool needs_protected_surface); |
| 272 | 284 |
| 273 // Called when a new key is added to the CDM. | 285 // Called when a new key is added to the CDM. |
| 274 void OnKeyAdded(); | 286 void OnKeyAdded(); |
| 275 | 287 |
| 276 // Notifies the client of the result of deferred initialization. | 288 // Notifies the client of the result of deferred initialization. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 350 |
| 339 // To expose client callbacks from VideoDecodeAccelerator. | 351 // To expose client callbacks from VideoDecodeAccelerator. |
| 340 Client* client_; | 352 Client* client_; |
| 341 | 353 |
| 342 // Callback to set the correct gl context. | 354 // Callback to set the correct gl context. |
| 343 MakeGLContextCurrentCallback make_context_current_cb_; | 355 MakeGLContextCurrentCallback make_context_current_cb_; |
| 344 | 356 |
| 345 // Callback to get the GLES2Decoder instance. | 357 // Callback to get the GLES2Decoder instance. |
| 346 GetGLES2DecoderCallback get_gles2_decoder_cb_; | 358 GetGLES2DecoderCallback get_gles2_decoder_cb_; |
| 347 | 359 |
| 348 // Whether the stream is encrypted. | |
| 349 bool is_encrypted_; | |
| 350 | |
| 351 // The current state of this class. For now, this is used only for setting | 360 // The current state of this class. For now, this is used only for setting |
| 352 // error state. | 361 // error state. |
| 353 State state_; | 362 State state_; |
| 354 | 363 |
| 355 // This map maintains the picture buffers passed to the client for decoding. | 364 // This map maintains the picture buffers passed to the client for decoding. |
| 356 // The key is the picture buffer id. | 365 // The key is the picture buffer id. |
| 357 OutputBufferMap output_picture_buffers_; | 366 OutputBufferMap output_picture_buffers_; |
| 358 | 367 |
| 359 // This keeps the free picture buffer ids which can be used for sending | 368 // This keeps the free picture buffer ids which can be used for sending |
| 360 // decoded frames to the client. | 369 // decoded frames to the client. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 // from being sent after a reset. | 427 // from being sent after a reset. |
| 419 int error_sequence_token_; | 428 int error_sequence_token_; |
| 420 | 429 |
| 421 // PostError will defer sending an error if and only if this is true. | 430 // PostError will defer sending an error if and only if this is true. |
| 422 bool defer_errors_; | 431 bool defer_errors_; |
| 423 | 432 |
| 424 // True if and only if VDA initialization is deferred, and we have not yet | 433 // True if and only if VDA initialization is deferred, and we have not yet |
| 425 // called NotifyInitializationComplete. | 434 // called NotifyInitializationComplete. |
| 426 bool deferred_initialization_pending_; | 435 bool deferred_initialization_pending_; |
| 427 | 436 |
| 428 int surface_id_; | 437 // Copy of the VDA::Config we were given. |
| 438 Config config_; |
| 429 | 439 |
| 430 OnDestroyingSurfaceCallback on_destroying_surface_cb_; | 440 OnDestroyingSurfaceCallback on_destroying_surface_cb_; |
| 431 | 441 |
| 432 // WeakPtrFactory for posting tasks back to |this|. | 442 // WeakPtrFactory for posting tasks back to |this|. |
| 433 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 443 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| 434 | 444 |
| 435 friend class AndroidVideoDecodeAcceleratorTest; | 445 friend class AndroidVideoDecodeAcceleratorTest; |
| 436 }; | 446 }; |
| 437 | 447 |
| 438 } // namespace media | 448 } // namespace media |
| 439 | 449 |
| 440 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 450 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |