| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // from breaking. NotifyError will do so immediately, PostError may wait. | 319 // from breaking. NotifyError will do so immediately, PostError may wait. |
| 320 // |token| has to match |error_sequence_token_|, or else it's assumed to be | 320 // |token| has to match |error_sequence_token_|, or else it's assumed to be |
| 321 // from a post that's prior to a previous reset, and ignored. | 321 // from a post that's prior to a previous reset, and ignored. |
| 322 void NotifyError(VideoDecodeAccelerator::Error error, int token); | 322 void NotifyError(VideoDecodeAccelerator::Error error, int token); |
| 323 | 323 |
| 324 // Start or stop our work-polling timer based on whether we did any work, and | 324 // Start or stop our work-polling timer based on whether we did any work, and |
| 325 // how long it has been since we've done work. Calling this with true will | 325 // how long it has been since we've done work. Calling this with true will |
| 326 // start the timer. Calling it with false may stop the timer. | 326 // start the timer. Calling it with false may stop the timer. |
| 327 void ManageTimer(bool did_work); | 327 void ManageTimer(bool did_work); |
| 328 | 328 |
| 329 // Safely clear |media_codec_|. Do this instead of calling reset() / assign. |
| 330 // Otherwise, the destructor can hang if mediaserver is in a bad state. This |
| 331 // will release immediately if safe, else post to a separate thread. Either |
| 332 // way, |media_codec_| will be null upon return. |
| 333 void ReleaseMediaCodec(); |
| 334 |
| 329 // Start the MediaCodec drain process by adding end_of_stream() buffer to the | 335 // Start the MediaCodec drain process by adding end_of_stream() buffer to the |
| 330 // encoded buffers queue. When we receive EOS from the output buffer the drain | 336 // encoded buffers queue. When we receive EOS from the output buffer the drain |
| 331 // process completes and we perform the action depending on the |drain_type|. | 337 // process completes and we perform the action depending on the |drain_type|. |
| 332 void StartCodecDrain(DrainType drain_type); | 338 void StartCodecDrain(DrainType drain_type); |
| 333 | 339 |
| 334 // Returns true if we are currently draining the codec and doing that as part | 340 // Returns true if we are currently draining the codec and doing that as part |
| 335 // of Reset() or Destroy() VP8 workaround. (http://crbug.com/598963). We won't | 341 // of Reset() or Destroy() VP8 workaround. (http://crbug.com/598963). We won't |
| 336 // display any frames and disable normal errors handling. | 342 // display any frames and disable normal errors handling. |
| 337 bool IsDrainingForResetOrDestroy() const; | 343 bool IsDrainingForResetOrDestroy() const; |
| 338 | 344 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 482 |
| 477 // WeakPtrFactory for posting tasks back to |this|. | 483 // WeakPtrFactory for posting tasks back to |this|. |
| 478 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 484 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| 479 | 485 |
| 480 friend class AndroidVideoDecodeAcceleratorTest; | 486 friend class AndroidVideoDecodeAcceleratorTest; |
| 481 }; | 487 }; |
| 482 | 488 |
| 483 } // namespace media | 489 } // namespace media |
| 484 | 490 |
| 485 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 491 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |