OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <cstring> | 5 #include <cstring> |
6 #include <map> | 6 #include <map> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. | 653 PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. |
654 if (!cdm_) { | 654 if (!cdm_) { |
655 SendUnknownKeyError(key_system_, session_id); | 655 SendUnknownKeyError(key_system_, session_id); |
656 return; | 656 return; |
657 } | 657 } |
658 | 658 |
659 const uint8_t* key_ptr = static_cast<const uint8_t*>(key.Map()); | 659 const uint8_t* key_ptr = static_cast<const uint8_t*>(key.Map()); |
660 int key_size = key.ByteLength(); | 660 int key_size = key.ByteLength(); |
661 const uint8_t* init_data_ptr = static_cast<const uint8_t*>(init_data.Map()); | 661 const uint8_t* init_data_ptr = static_cast<const uint8_t*>(init_data.Map()); |
662 int init_data_size = init_data.ByteLength(); | 662 int init_data_size = init_data.ByteLength(); |
| 663 PP_DCHECK(!init_data_ptr == !init_data_size); |
663 | 664 |
664 if (!key_ptr || key_size <= 0 || !init_data_ptr || init_data_size <= 0) { | 665 if (!key_ptr || key_size <= 0) { |
665 SendUnknownKeyError(key_system_, session_id); | 666 SendUnknownKeyError(key_system_, session_id); |
666 return; | 667 return; |
667 } | 668 } |
668 | 669 |
669 cdm::Status status = cdm_->AddKey(session_id.data(), session_id.size(), | 670 cdm::Status status = cdm_->AddKey(session_id.data(), session_id.size(), |
670 key_ptr, key_size, | 671 key_ptr, key_size, |
671 init_data_ptr, init_data_size); | 672 init_data_ptr, init_data_size); |
672 PP_DCHECK(status == cdm::kSuccess || status == cdm::kSessionError); | 673 PP_DCHECK(status == cdm::kSuccess || status == cdm::kSessionError); |
673 if (status != cdm::kSuccess) { | 674 if (status != cdm::kSuccess) { |
674 SendUnknownKeyError(key_system_, session_id); | 675 SendUnknownKeyError(key_system_, session_id); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 } // namespace webkit_media | 1138 } // namespace webkit_media |
1138 | 1139 |
1139 namespace pp { | 1140 namespace pp { |
1140 | 1141 |
1141 // Factory function for your specialization of the Module object. | 1142 // Factory function for your specialization of the Module object. |
1142 Module* CreateModule() { | 1143 Module* CreateModule() { |
1143 return new webkit_media::CdmWrapperModule(); | 1144 return new webkit_media::CdmWrapperModule(); |
1144 } | 1145 } |
1145 | 1146 |
1146 } // namespace pp | 1147 } // namespace pp |
OLD | NEW |