| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "media/cdm/cdm_adapter.h" | 5 #include "media/cdm/cdm_adapter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 // End of stream buffers are represented as empty resources. | 249 // End of stream buffers are represented as empty resources. |
| 250 DCHECK(!input_buffer->data); | 250 DCHECK(!input_buffer->data); |
| 251 if (encrypted_buffer->end_of_stream()) | 251 if (encrypted_buffer->end_of_stream()) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 input_buffer->data = encrypted_buffer->data(); | 254 input_buffer->data = encrypted_buffer->data(); |
| 255 input_buffer->data_size = encrypted_buffer->data_size(); | 255 input_buffer->data_size = encrypted_buffer->data_size(); |
| 256 | 256 |
| 257 const DecryptConfig* decrypt_config = encrypted_buffer->decrypt_config(); | 257 const DecryptConfig* decrypt_config = encrypted_buffer->decrypt_config(); |
| 258 input_buffer->key_id = | 258 input_buffer->key_id = |
| 259 reinterpret_cast<const uint8*>(decrypt_config->key_id().data()); | 259 reinterpret_cast<const uint8_t*>(decrypt_config->key_id().data()); |
| 260 input_buffer->key_id_size = decrypt_config->key_id().size(); | 260 input_buffer->key_id_size = decrypt_config->key_id().size(); |
| 261 input_buffer->iv = | 261 input_buffer->iv = |
| 262 reinterpret_cast<const uint8*>(decrypt_config->iv().data()); | 262 reinterpret_cast<const uint8_t*>(decrypt_config->iv().data()); |
| 263 input_buffer->iv_size = decrypt_config->iv().size(); | 263 input_buffer->iv_size = decrypt_config->iv().size(); |
| 264 | 264 |
| 265 DCHECK(subsamples->empty()); | 265 DCHECK(subsamples->empty()); |
| 266 size_t num_subsamples = decrypt_config->subsamples().size(); | 266 size_t num_subsamples = decrypt_config->subsamples().size(); |
| 267 if (num_subsamples > 0) { | 267 if (num_subsamples > 0) { |
| 268 subsamples->reserve(num_subsamples); | 268 subsamples->reserve(num_subsamples); |
| 269 for (const auto& sample : decrypt_config->subsamples()) { | 269 for (const auto& sample : decrypt_config->subsamples()) { |
| 270 subsamples->push_back( | 270 subsamples->push_back( |
| 271 cdm::SubsampleEntry(sample.clear_bytes, sample.cypher_bytes)); | 271 cdm::SubsampleEntry(sample.clear_bytes, sample.cypher_bytes)); |
| 272 } | 272 } |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 message_type != cdm::MessageType::kLicenseRequest); | 765 message_type != cdm::MessageType::kLicenseRequest); |
| 766 | 766 |
| 767 GURL verified_gurl = | 767 GURL verified_gurl = |
| 768 GURL(std::string(legacy_destination_url, legacy_destination_url_size)); | 768 GURL(std::string(legacy_destination_url, legacy_destination_url_size)); |
| 769 if (!verified_gurl.is_valid()) { | 769 if (!verified_gurl.is_valid()) { |
| 770 DLOG(WARNING) << "SessionMessage legacy_destination_url is invalid : " | 770 DLOG(WARNING) << "SessionMessage legacy_destination_url is invalid : " |
| 771 << verified_gurl.possibly_invalid_spec(); | 771 << verified_gurl.possibly_invalid_spec(); |
| 772 verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url. | 772 verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url. |
| 773 } | 773 } |
| 774 | 774 |
| 775 const uint8_t* message_ptr = reinterpret_cast<const uint8*>(message); | 775 const uint8_t* message_ptr = reinterpret_cast<const uint8_t*>(message); |
| 776 session_message_cb_.Run( | 776 session_message_cb_.Run( |
| 777 std::string(session_id, session_id_size), | 777 std::string(session_id, session_id_size), |
| 778 ToMediaMessageType(message_type), | 778 ToMediaMessageType(message_type), |
| 779 std::vector<uint8_t>(message_ptr, message_ptr + message_size), | 779 std::vector<uint8_t>(message_ptr, message_ptr + message_size), |
| 780 verified_gurl); | 780 verified_gurl); |
| 781 } | 781 } |
| 782 | 782 |
| 783 void CdmAdapter::OnSessionKeysChange(const char* session_id, | 783 void CdmAdapter::OnSessionKeysChange(const char* session_id, |
| 784 uint32_t session_id_size, | 784 uint32_t session_id_size, |
| 785 bool has_additional_usable_key, | 785 bool has_additional_usable_key, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 result_frames->push_back(frame); | 947 result_frames->push_back(frame); |
| 948 | 948 |
| 949 data += frame_size; | 949 data += frame_size; |
| 950 bytes_left -= frame_size; | 950 bytes_left -= frame_size; |
| 951 } while (bytes_left > 0); | 951 } while (bytes_left > 0); |
| 952 | 952 |
| 953 return true; | 953 return true; |
| 954 } | 954 } |
| 955 | 955 |
| 956 } // namespace media | 956 } // namespace media |
| OLD | NEW |