Index: media/base/android/media_codec_decoder.h |
diff --git a/media/base/android/media_codec_decoder.h b/media/base/android/media_codec_decoder.h |
index d22744fabc8dbae19e2fe0b767054ddcf3d0aa54..0b955fa1424fbfed39622ca3f1c18ede1f6ab935 100644 |
--- a/media/base/android/media_codec_decoder.h |
+++ b/media/base/android/media_codec_decoder.h |
@@ -16,6 +16,7 @@ |
#include "base/time/time.h" |
#include "media/base/android/access_unit_queue.h" |
#include "media/base/android/demuxer_stream_player_params.h" |
+#include "media/base/android/media_drm_bridge.h" |
namespace media { |
@@ -118,6 +119,7 @@ class MediaCodecDecoder { |
enum ConfigStatus { |
kConfigFailure = 0, |
kConfigOk, |
+ kConfigNoCrypto, |
kConfigKeyFrameRequired, |
}; |
@@ -162,6 +164,7 @@ class MediaCodecDecoder { |
const base::Closure& starvation_cb, |
const base::Closure& decoder_drained_cb, |
const base::Closure& stop_done_cb, |
+ const base::Closure& key_required_cb, |
const base::Closure& error_cb, |
const char* decoder_thread_name); |
virtual ~MediaCodecDecoder(); |
@@ -177,6 +180,10 @@ class MediaCodecDecoder { |
// Stores configuration for the use of upcoming Configure() |
virtual void SetDemuxerConfigs(const DemuxerConfigs& configs) = 0; |
+ // Returns true if the DemuxerConfigs announce that content is encrypted and |
+ // that MediaCrypto is required for configuration. |
+ virtual bool IsContentEncrypted() const = 0; |
+ |
// Stops decoder thread, releases the MediaCodecBridge and other resources. |
virtual void ReleaseDecoderResources() = 0; |
@@ -196,14 +203,15 @@ class MediaCodecDecoder { |
// Sets preroll timestamp and requests preroll. |
void SetPrerollTimestamp(base::TimeDelta preroll_ts); |
- base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); |
+ // Sets the DRM bridge pointer. |
+ void SetDrmBridge(MediaDrmBridge* drm_bridge); |
// Starts prefetching: accumulates enough data in AccessUnitQueue. |
// Decoder thread is not running. |
void Prefetch(const base::Closure& prefetch_done_cb); |
// Configures MediaCodec. |
- ConfigStatus Configure(); |
+ ConfigStatus Configure(jobject media_crypto); |
// Starts the decoder for prerolling. This method starts the decoder thread. |
bool Preroll(const base::Closure& preroll_done_cb); |
@@ -254,7 +262,7 @@ class MediaCodecDecoder { |
// Does the part of MediaCodecBridge configuration that is specific |
// to audio or video. |
- virtual ConfigStatus ConfigureInternal() = 0; |
+ virtual ConfigStatus ConfigureInternal(jobject media_crypto) = 0; |
// Associates PTS with device time so we can calculate delays. |
// We use delays for video decoder only. |
@@ -314,6 +322,9 @@ class MediaCodecDecoder { |
// The queue of access units. |
AccessUnitQueue au_queue_; |
+ // Pointer to a DRM object that will be used for encrypted streams. |
+ MediaDrmBridge* drm_bridge_; |
+ |
// Flag forces reconfiguration even if |media_codec_bridge_| exists. Currently |
// is set by video decoder when the video surface changes. |
bool needs_reconfigure_; |
@@ -388,6 +399,7 @@ class MediaCodecDecoder { |
base::Closure preroll_done_cb_; |
base::Closure decoder_drained_cb_; |
base::Closure stop_done_cb_; |
+ base::Closure key_required_cb_; |
base::Closure error_cb_; |
// Data request callback that is posted by decoder internally. |
@@ -412,6 +424,10 @@ class MediaCodecDecoder { |
// Flag is set when the EOS is enqueued into MediaCodec. Reset by Flush. |
bool eos_enqueued_; |
+ // Flag is set when NO_KEY error is received from QueueSecureInputBuffer. |
+ // Reset after we stop. |
+ bool key_request_posted_; |
+ |
// Flag is set when the EOS is received in MediaCodec output. Reset by Flush. |
bool completed_; |