Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: media/filters/decrypting_audio_decoder.cc

Issue 2543623003: media: Allow config change between clear and encrypted streams (Closed)
Patch Set: media: Allow config change between clear and encrypted streams Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/filters/decrypting_audio_decoder.cc
diff --git a/media/filters/decrypting_audio_decoder.cc b/media/filters/decrypting_audio_decoder.cc
index 6ae354c47b3cd9b999a61c329a3169451e7943e0..d2565ccb593294aa950b16f6baf9c9b98caeea52 100644
--- a/media/filters/decrypting_audio_decoder.cc
+++ b/media/filters/decrypting_audio_decoder.cc
@@ -63,23 +63,17 @@ void DecryptingAudioDecoder::Initialize(const AudioDecoderConfig& config,
init_cb_ = BindToCurrentLoop(init_cb);
output_cb_ = BindToCurrentLoop(output_cb);
- // TODO(xhwang): We should be able to DCHECK config.IsValidConfig() and
- // config.is_encrypted().
+ // TODO(xhwang): We should be able to DCHECK config.IsValidConfig().
if (!config.IsValidConfig()) {
DLOG(ERROR) << "Invalid audio stream config.";
base::ResetAndReturn(&init_cb_).Run(false);
return;
}
- // DecryptingAudioDecoder only accepts potentially encrypted stream.
- if (!config.is_encrypted()) {
- base::ResetAndReturn(&init_cb_).Run(false);
- return;
- }
-
config_ = config;
if (state_ == kUninitialized) {
+ DCHECK(config.is_encrypted());
Joey Parrish 2016/12/01 22:28:10 This is protecting the renderer? Might be good to
ddorwin 2016/12/05 23:53:04 There should probably be a comment/TODO with the c
xhwang 2016/12/16 20:12:28 joeyparrish: This is an internal contract between
DCHECK(cdm_context);
if (!cdm_context->GetDecryptor()) {
MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no decryptor";
@@ -89,7 +83,8 @@ void DecryptingAudioDecoder::Initialize(const AudioDecoderConfig& config,
decryptor_ = cdm_context->GetDecryptor();
} else {
- // Reinitialization (i.e. upon a config change)
+ // Reinitialization (i.e. upon a config change, the new config can be
ddorwin 2016/12/05 23:53:04 The new text seems like a separate thought and may
xhwang 2016/12/16 20:12:28 Done.
+ // encrypted or clear).
decryptor_->DeinitializeDecoder(Decryptor::kAudio);
}

Powered by Google App Engine
This is Rietveld 408576698