| Index: media/base/android/media_codec_video_decoder.cc
|
| diff --git a/media/base/android/media_codec_video_decoder.cc b/media/base/android/media_codec_video_decoder.cc
|
| index 48b278ad137ca961fdcb415cdf948ee5e7dda29b..70d477d7d5b701af186887ee89f8b90ea884cbac 100644
|
| --- a/media/base/android/media_codec_video_decoder.cc
|
| +++ b/media/base/android/media_codec_video_decoder.cc
|
| @@ -22,6 +22,7 @@ MediaCodecVideoDecoder::MediaCodecVideoDecoder(
|
| 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 SetTimeCallback& update_current_time_cb,
|
| const VideoSizeChangedCallback& video_size_changed_cb,
|
| @@ -31,8 +32,10 @@ MediaCodecVideoDecoder::MediaCodecVideoDecoder(
|
| starvation_cb,
|
| decoder_drained_cb,
|
| stop_done_cb,
|
| + key_required_cb,
|
| error_cb,
|
| "VideoDecoder"),
|
| + is_protected_surface_required_(false),
|
| update_current_time_cb_(update_current_time_cb),
|
| video_size_changed_cb_(video_size_changed_cb),
|
| codec_created_cb_(codec_created_cb) {
|
| @@ -66,6 +69,10 @@ void MediaCodecVideoDecoder::SetDemuxerConfigs(const DemuxerConfigs& configs) {
|
| }
|
| }
|
|
|
| +bool MediaCodecVideoDecoder::IsContentEncrypted() const {
|
| + return configs_.is_video_encrypted;
|
| +}
|
| +
|
| void MediaCodecVideoDecoder::ReleaseDecoderResources() {
|
| DCHECK(media_task_runner_->BelongsToCurrentThread());
|
| DVLOG(1) << class_name() << "::" << __FUNCTION__;
|
| @@ -101,6 +108,18 @@ bool MediaCodecVideoDecoder::HasVideoSurface() const {
|
| return !surface_.IsEmpty();
|
| }
|
|
|
| +void MediaCodecVideoDecoder::SetProtectedSurfaceRequired(bool value) {
|
| + DCHECK(media_task_runner_->BelongsToCurrentThread());
|
| +
|
| + is_protected_surface_required_ = value;
|
| +}
|
| +
|
| +bool MediaCodecVideoDecoder::IsProtectedSurfaceRequired() const {
|
| + DCHECK(media_task_runner_->BelongsToCurrentThread());
|
| +
|
| + return is_protected_surface_required_;
|
| +}
|
| +
|
| bool MediaCodecVideoDecoder::IsCodecReconfigureNeeded(
|
| const DemuxerConfigs& next) const {
|
| if (always_reconfigure_for_tests_)
|
| @@ -123,7 +142,8 @@ bool MediaCodecVideoDecoder::IsCodecReconfigureNeeded(
|
| next.video_size.height());
|
| }
|
|
|
| -MediaCodecDecoder::ConfigStatus MediaCodecVideoDecoder::ConfigureInternal() {
|
| +MediaCodecDecoder::ConfigStatus MediaCodecVideoDecoder::ConfigureInternal(
|
| + jobject media_crypto) {
|
| DCHECK(media_task_runner_->BelongsToCurrentThread());
|
|
|
| DVLOG(1) << class_name() << "::" << __FUNCTION__;
|
| @@ -136,27 +156,23 @@ MediaCodecDecoder::ConfigStatus MediaCodecVideoDecoder::ConfigureInternal() {
|
|
|
| if (configs_.video_codec == kUnknownVideoCodec) {
|
| DVLOG(0) << class_name() << "::" << __FUNCTION__
|
| - << " configuration parameters are required";
|
| + << ": configuration parameters are required";
|
| return kConfigFailure;
|
| }
|
|
|
| - // TODO(timav): implement DRM.
|
| - // bool is_secure = is_content_encrypted() && drm_bridge() &&
|
| - // drm_bridge()->IsProtectedSurfaceRequired();
|
| -
|
| - bool is_secure = false; // DRM is not implemented
|
| -
|
| if (surface_.IsEmpty()) {
|
| - DVLOG(0) << class_name() << "::" << __FUNCTION__ << " surface required";
|
| + DVLOG(0) << class_name() << "::" << __FUNCTION__ << ": surface is required";
|
| return kConfigFailure;
|
| }
|
|
|
| + bool is_secure = IsContentEncrypted() && is_protected_surface_required_;
|
| +
|
| media_codec_bridge_.reset(VideoCodecBridge::CreateDecoder(
|
| configs_.video_codec,
|
| is_secure,
|
| configs_.video_size,
|
| surface_.j_surface().obj(),
|
| - GetMediaCrypto().obj()));
|
| + media_crypto));
|
|
|
| if (!media_codec_bridge_) {
|
| DVLOG(0) << class_name() << "::" << __FUNCTION__
|
|
|