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

Unified Diff: media/crypto/aes_decryptor.cc

Issue 10823110: Add support for v0.3 of the encrypted WebM specification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments from Patch Set 4. Created 8 years, 5 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 | « media/base/decrypt_config.cc ('k') | media/crypto/aes_decryptor_unittest.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 e5858003f21b6fd38c3212568991f6e1336bc2fd..27272c67e03c1f15f1bbfbf2d7dbdbc4835655cf 100644
--- a/media/crypto/aes_decryptor.cc
+++ b/media/crypto/aes_decryptor.cc
@@ -285,17 +285,24 @@ void AesDecryptor::Decrypt(const scoped_refptr<DecoderBuffer>& encrypted,
return;
}
- // TODO(strobe): Currently, presence of checksum is used to indicate the use
- // of normal or WebM decryption keys. Consider a more explicit signaling
- // mechanism and the removal of the webm_decryption_key member.
- crypto::SymmetricKey* decryption_key = (checksum_size > 0) ?
- key->webm_decryption_key() : key->decryption_key();
- scoped_refptr<DecoderBuffer> decrypted =
- DecryptData(*encrypted, decryption_key);
- if (!decrypted) {
- DVLOG(1) << "Decryption failed.";
- decrypt_cb.Run(kError, NULL);
- return;
+ scoped_refptr<DecoderBuffer> decrypted;
+ // An empty iv string signals that the frame is unencrypted.
+ if (encrypted->GetDecryptConfig()->iv().empty()) {
+ int data_offset = encrypted->GetDecryptConfig()->data_offset();
+ decrypted = DecoderBuffer::CopyFrom(encrypted->GetData() + data_offset,
+ encrypted->GetDataSize() - data_offset);
+ } else {
+ // TODO(strobe): Currently, presence of checksum is used to indicate the use
+ // of normal or WebM decryption keys. Consider a more explicit signaling
+ // mechanism and the removal of the webm_decryption_key member.
+ crypto::SymmetricKey* decryption_key = (checksum_size > 0) ?
+ key->webm_decryption_key() : key->decryption_key();
+ decrypted = DecryptData(*encrypted, decryption_key);
+ if (!decrypted) {
+ DVLOG(1) << "Decryption failed.";
+ decrypt_cb.Run(kError, NULL);
+ return;
+ }
}
decrypted->SetTimestamp(encrypted->GetTimestamp());
« no previous file with comments | « media/base/decrypt_config.cc ('k') | media/crypto/aes_decryptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698