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

Unified Diff: media/crypto/aes_decryptor.cc

Issue 11348365: Encrypted Media: Allows empty key message to be fired. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update doc Created 8 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
« no previous file with comments | « no previous file | 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 88d194ea574f31bca3bf0732957f8d18fb69e247..a1dd46a481efbd7fc2a208b00da368703a568c2e 100644
--- a/media/crypto/aes_decryptor.cc
+++ b/media/crypto/aes_decryptor.cc
@@ -139,16 +139,16 @@ bool AesDecryptor::GenerateKeyRequest(const std::string& key_system,
int init_data_length) {
std::string session_id_string(base::UintToString(next_session_id_++));
- if (!init_data || !init_data_length) {
- DVLOG(1) << "init_data required to generate a key request.";
- return false;
- }
-
// For now, the AesDecryptor does not care about |key_system| and |type|;
// just fire the event with the |init_data| as the request.
- int message_length = init_data_length;
- scoped_array<uint8> message(new uint8[message_length]);
- memcpy(message.get(), init_data, message_length);
+ scoped_array<uint8> message;
+ int message_length = 0;
+
+ if (init_data && init_data_length) {
+ message_length = init_data_length;
+ message.reset(new uint8[message_length]);
+ memcpy(message.get(), init_data, message_length);
+ }
client_->KeyMessage(key_system, session_id_string,
message.Pass(), message_length, "");
« no previous file with comments | « no previous file | media/crypto/aes_decryptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698