| 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 1e0543d3fc5f228e356ac47c0d131a0992ddc99a..00e2963bc949b9cab3f8d2177754ec83dedd772b 100644
|
| --- a/content/common/gpu/media/android_video_decode_accelerator.h
|
| +++ b/content/common/gpu/media/android_video_decode_accelerator.h
|
| @@ -86,13 +86,17 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator
|
| virtual void ReuseOnePictureBuffer(
|
| const media::PictureBuffer& picture_buffer) {}
|
|
|
| + // Release MediaCodec buffers.
|
| + virtual void ReleaseCodecBuffers(
|
| + const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) {}
|
| +
|
| + // Attempts to free up codec output buffers by rendering early.
|
| + virtual void MaybeRenderEarly() {}
|
| +
|
| // 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.
|
| - // For convenience, a container of PictureBuffers is provided in case
|
| - // per-image cleanup is needed.
|
| - virtual void CodecChanged(media::VideoCodecBridge* codec,
|
| - const OutputBufferMap& buffer_map) = 0;
|
| + virtual void CodecChanged(media::VideoCodecBridge* codec) = 0;
|
|
|
| // Notify the strategy that a frame is available. This callback can happen
|
| // on any thread at any time.
|
| @@ -159,7 +163,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.
|
| @@ -196,6 +206,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_|
|
| @@ -282,11 +295,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://crbug.com/598963). We won't
|
| + // display 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(const base::Closure& done_cb);
|
|
|
| // Return true if and only if we should use deferred rendering.
|
| static bool UseDeferredRenderingStrategy(
|
| @@ -352,6 +381,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.
|
|
|