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 6728270817a87e0e6362cf9caa8a24043d0d6183..ad92d63fff1b45fc483f53a4990616006129e17c 100644 |
--- a/content/common/gpu/media/android_video_decode_accelerator.h |
+++ b/content/common/gpu/media/android_video_decode_accelerator.h |
@@ -86,6 +86,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. |
@@ -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,21 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
// start the timer. Calling it with false may stop the timer. |
void ManageTimer(bool did_work); |
+ // Request the MediaCodec drain by adding end_of_stream() buffer to the |
+ // encoded buffers queue. When the drain completes the |drain_completed_cb| |
+ // will be called. |
+ void RequestDrain(DrainType drain_type, base::Closure drain_completed_cb); |
+ |
+ // 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 |
+ // any frames and disable normal errors handling. |
+ bool IsDrainingForReset() const; |
+ |
// 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(); |
+ void ResetCodecState(base::Closure notification_cb); |
// Return true if and only if we should use deferred rendering. |
static bool UseDeferredRenderingStrategy( |
@@ -352,6 +375,16 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
// Time at which we last did useful work on io_timer_. |
base::TimeTicks most_recent_work_; |
+ // MediaCodec drain mechanism. |
+ |
+ // A callback to be called on the end of the decoder drain process, i.e. |
+ // after EOS comes from decoder's output. |
+ base::Closure drain_completed_cb_; |
+ |
+ // We have to distinguish between various drain requests since the next might |
+ // come while prior is still being processed. |
watk
2016/04/18 21:12:18
It might be worth mentioning that we need to be ab
Tima Vaisburd
2016/04/20 01:54:19
I referred to IsDrainingForresetOrDestroy() where
|
+ DrainType drain_type_; |
+ |
// CDM related stuff. |
// Holds a ref-count to the CDM to avoid using the CDM after it's destroyed. |