Chromium Code Reviews| Index: content/common/gpu/media/android_video_decode_accelerator.h |
| diff --git a/content/common/gpu/media/android_video_decode_accelerator.h b/content/common/gpu/media/android_video_decode_accelerator.h |
| index 6bbe4dbd1deb5bc4b34185799df2e8068da7690e..eecb5d487b295d3b9f4fa2f82ac5717103e424b5 100644 |
| --- a/content/common/gpu/media/android_video_decode_accelerator.h |
| +++ b/content/common/gpu/media/android_video_decode_accelerator.h |
| @@ -87,6 +87,10 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| virtual void ReuseOnePictureBuffer( |
| const media::PictureBuffer& picture_buffer) {} |
| + // Release MediaCodec buffers. |
| + virtual void ReleaseCodecBuffers( |
| + const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) {} |
| + |
| // Notify strategy that we have a new android MediaCodec instance. This |
| // happens when we're starting up or re-configuring mid-stream. Any |
| // previously provided codec should no longer be referenced. |
| @@ -160,7 +164,13 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| WAITING_FOR_CODEC, |
| // Set when we have a codec, but it doesn't yet have a key. |
| WAITING_FOR_KEY, |
| - WAITING_FOR_EOS, |
| + }; |
| + |
| + enum DrainType { |
| + DRAIN_TYPE_NONE, |
| + DRAIN_FOR_FLUSH, |
| + DRAIN_FOR_RESET, |
| + DRAIN_FOR_DESTROY, |
| }; |
| // Configuration info for MediaCodec. |
| @@ -197,6 +207,9 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| DISALLOW_COPY_AND_ASSIGN(CodecConfig); |
| }; |
| + // A part of destruction process that is sometimes postponed after the drain. |
| + void ActualDestroy(); |
| + |
| // Configures |media_codec_| with the given codec parameters from the client. |
| // This configuration will (probably) not be complete before this call |
| // returns. Multiple calls before completion will be ignored. |state_| |
| @@ -283,11 +296,27 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| // start the timer. Calling it with false may stop the timer. |
| void ManageTimer(bool did_work); |
| + // Start the MediaCodec drain process by adding end_of_stream() buffer to the |
| + // encoded buffers queue. When we receive EOS from the output buffer the drain |
| + // process completes and we perform the action depending on the |drain_type|. |
| + void StartCodecDrain(DrainType drain_type); |
| + |
| + // Returns true if we are currently draining the codec and doing that as part |
| + // of Reset() or Destroy() VP8 workaround. (http://598963). We won't display |
|
DaleCurtis
2016/04/21 00:16:07
http://crbug.com/598963
Tima Vaisburd
2016/04/21 21:38:22
Done.
|
| + // any frames and disable normal errors handling. |
| + bool IsDrainingForResetOrDestroy() const; |
| + |
| + // A helper method that performs the operation required after the drain |
| + // completion (usually when we receive EOS in the output). The operation |
| + // itself depends on the |drain_type_|. |
| + void OnDrainCompleted(); |
| + |
| // Resets MediaCodec and buffers/containers used for storing output. These |
| // components need to be reset upon EOS to decode a later stream. Input state |
| // (e.g. queued BitstreamBuffers) is not reset, as input following an EOS |
| - // is still valid and should be processed. |
| - void ResetCodecState(); |
| + // is still valid and should be processed. Upon competion calls |done_cb| that |
| + // can be a null callback. |
| + void ResetCodecState(base::Closure done_cb); |
|
DaleCurtis
2016/04/21 00:16:07
const&
Tima Vaisburd
2016/04/21 21:38:22
Done.
|
| // Return true if and only if we should use deferred rendering. |
| static bool UseDeferredRenderingStrategy( |
| @@ -353,6 +382,10 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| // Time at which we last did useful work on io_timer_. |
| base::TimeTicks most_recent_work_; |
| + // Type of a drain request. We need to distinguish between DRAIN_FOR_FLUSH |
| + // and other types, see IsDrainingForResetOrDestroy(). |
| + DrainType drain_type_; |
| + |
| // CDM related stuff. |
| // Holds a ref-count to the CDM to avoid using the CDM after it's destroyed. |