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

Unified Diff: media/crypto/aes_decryptor.cc

Issue 11830024: Do not require a key before processing unencrypted frames within a potentially encrypted stream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 11 months 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
« no previous file with comments | « no previous file | media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/crypto/aes_decryptor.cc
diff --git a/media/crypto/aes_decryptor.cc b/media/crypto/aes_decryptor.cc
index 83f818e60d015118785d090f1b31c35e786195d3..349e300a585eb941c03c505fd44fbea5ec97bba9 100644
--- a/media/crypto/aes_decryptor.cc
+++ b/media/crypto/aes_decryptor.cc
@@ -232,14 +232,6 @@ void AesDecryptor::Decrypt(StreamType stream_type,
const scoped_refptr<DecoderBuffer>& encrypted,
const DecryptCB& decrypt_cb) {
CHECK(encrypted->GetDecryptConfig());
- const std::string& key_id = encrypted->GetDecryptConfig()->key_id();
-
- DecryptionKey* key = GetKey(key_id);
- if (!key) {
- DVLOG(1) << "Could not find a matching key for the given key ID.";
- decrypt_cb.Run(kNoKey, NULL);
- return;
- }
scoped_refptr<DecoderBuffer> decrypted;
// An empty iv string signals that the frame is unencrypted.
@@ -248,6 +240,14 @@ void AesDecryptor::Decrypt(StreamType stream_type,
decrypted = DecoderBuffer::CopyFrom(encrypted->GetData() + data_offset,
encrypted->GetDataSize() - data_offset);
} else {
+ const std::string& key_id = encrypted->GetDecryptConfig()->key_id();
+ DecryptionKey* key = GetKey(key_id);
+ if (!key) {
+ DVLOG(1) << "Could not find a matching key for the given key ID.";
+ decrypt_cb.Run(kNoKey, NULL);
+ return;
+ }
+
crypto::SymmetricKey* decryption_key = key->decryption_key();
decrypted = DecryptData(*encrypted, decryption_key);
if (!decrypted) {
« no previous file with comments | « no previous file | media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698