| Index: media/filters/decrypting_video_decoder.cc
|
| diff --git a/media/filters/decrypting_video_decoder.cc b/media/filters/decrypting_video_decoder.cc
|
| index 19e62b3ab30b05be08851852f85737471ef6d31a..ac6a244951a6445c4e4164894e2adba4c31a72f6 100644
|
| --- a/media/filters/decrypting_video_decoder.cc
|
| +++ b/media/filters/decrypting_video_decoder.cc
|
| @@ -23,18 +23,17 @@ const char DecryptingVideoDecoder::kDecoderName[] = "DecryptingVideoDecoder";
|
| DecryptingVideoDecoder::DecryptingVideoDecoder(
|
| const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
|
| const scoped_refptr<MediaLog>& media_log,
|
| - const SetDecryptorReadyCB& set_decryptor_ready_cb,
|
| + const SetCdmReadyCB& set_cdm_ready_cb,
|
| const base::Closure& waiting_for_decryption_key_cb)
|
| : task_runner_(task_runner),
|
| media_log_(media_log),
|
| state_(kUninitialized),
|
| waiting_for_decryption_key_cb_(waiting_for_decryption_key_cb),
|
| - set_decryptor_ready_cb_(set_decryptor_ready_cb),
|
| + set_cdm_ready_cb_(set_cdm_ready_cb),
|
| decryptor_(NULL),
|
| key_added_while_decode_pending_(false),
|
| trace_id_(0),
|
| - weak_factory_(this) {
|
| -}
|
| + weak_factory_(this) {}
|
|
|
| std::string DecryptingVideoDecoder::GetDisplayName() const {
|
| return kDecoderName;
|
| @@ -61,8 +60,8 @@ void DecryptingVideoDecoder::Initialize(const VideoDecoderConfig& config,
|
|
|
| if (state_ == kUninitialized) {
|
| state_ = kDecryptorRequested;
|
| - set_decryptor_ready_cb_.Run(BindToCurrentLoop(base::Bind(
|
| - &DecryptingVideoDecoder::SetDecryptor, weak_this_)));
|
| + set_cdm_ready_cb_.Run(BindToCurrentLoop(
|
| + base::Bind(&DecryptingVideoDecoder::SetCdm, weak_this_)));
|
| return;
|
| }
|
|
|
| @@ -145,8 +144,8 @@ DecryptingVideoDecoder::~DecryptingVideoDecoder() {
|
| decryptor_->DeinitializeDecoder(Decryptor::kVideo);
|
| decryptor_ = NULL;
|
| }
|
| - if (!set_decryptor_ready_cb_.is_null())
|
| - base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB());
|
| + if (!set_cdm_ready_cb_.is_null())
|
| + base::ResetAndReturn(&set_cdm_ready_cb_).Run(CdmReadyCB());
|
| pending_buffer_to_decode_ = NULL;
|
| if (!init_cb_.is_null())
|
| base::ResetAndReturn(&init_cb_).Run(false);
|
| @@ -156,32 +155,31 @@ DecryptingVideoDecoder::~DecryptingVideoDecoder() {
|
| base::ResetAndReturn(&reset_cb_).Run();
|
| }
|
|
|
| -void DecryptingVideoDecoder::SetDecryptor(
|
| - Decryptor* decryptor,
|
| - const DecryptorAttachedCB& decryptor_attached_cb) {
|
| - DVLOG(2) << "SetDecryptor()";
|
| +void DecryptingVideoDecoder::SetCdm(CdmContext* cdm_context,
|
| + const CdmAttachedCB& cdm_attached_cb) {
|
| + DVLOG(2) << __FUNCTION__;
|
| DCHECK(task_runner_->BelongsToCurrentThread());
|
| DCHECK_EQ(state_, kDecryptorRequested) << state_;
|
| DCHECK(!init_cb_.is_null());
|
| - DCHECK(!set_decryptor_ready_cb_.is_null());
|
| - set_decryptor_ready_cb_.Reset();
|
| + DCHECK(!set_cdm_ready_cb_.is_null());
|
| + set_cdm_ready_cb_.Reset();
|
|
|
| - if (!decryptor) {
|
| + if (!cdm_context || !cdm_context->GetDecryptor()) {
|
| MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no decryptor set";
|
| base::ResetAndReturn(&init_cb_).Run(false);
|
| state_ = kError;
|
| - decryptor_attached_cb.Run(false);
|
| + cdm_attached_cb.Run(false);
|
| return;
|
| }
|
|
|
| - decryptor_ = decryptor;
|
| + decryptor_ = cdm_context->GetDecryptor();
|
|
|
| state_ = kPendingDecoderInit;
|
| decryptor_->InitializeVideoDecoder(
|
| config_,
|
| BindToCurrentLoop(base::Bind(
|
| &DecryptingVideoDecoder::FinishInitialization, weak_this_)));
|
| - decryptor_attached_cb.Run(true);
|
| + cdm_attached_cb.Run(true);
|
| }
|
|
|
| void DecryptingVideoDecoder::FinishInitialization(bool success) {
|
|
|