| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "webkit/renderer/media/crypto/ppapi/clear_key_cdm.h" | 5 #include "webkit/renderer/media/crypto/ppapi/clear_key_cdm.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 void ClearKeyCdm::Client::KeyMessage(const std::string& session_id, | 175 void ClearKeyCdm::Client::KeyMessage(const std::string& session_id, |
| 176 const std::string& message, | 176 const std::string& message, |
| 177 const std::string& default_url) { | 177 const std::string& default_url) { |
| 178 status_ = kKeyMessage; | 178 status_ = kKeyMessage; |
| 179 session_id_ = session_id; | 179 session_id_ = session_id; |
| 180 key_message_ = message; | 180 key_message_ = message; |
| 181 default_url_ = default_url; | 181 default_url_ = default_url; |
| 182 } | 182 } |
| 183 | 183 |
| 184 void ClearKeyCdm::Client::NeedKey(const std::string& session_id, | |
| 185 const std::string& type, | |
| 186 scoped_ptr<uint8[]> init_data, | |
| 187 int init_data_length) { | |
| 188 // In the current implementation of AesDecryptor, NeedKey is not used. | |
| 189 // If no key is available to decrypt an input buffer, it returns kNoKey to | |
| 190 // the caller instead of firing NeedKey. | |
| 191 NOTREACHED(); | |
| 192 } | |
| 193 | |
| 194 ClearKeyCdm::ClearKeyCdm(cdm::Host* host) | 184 ClearKeyCdm::ClearKeyCdm(cdm::Host* host) |
| 195 : decryptor_(base::Bind(&Client::KeyAdded, base::Unretained(&client_)), | 185 : decryptor_(base::Bind(&Client::KeyAdded, base::Unretained(&client_)), |
| 196 base::Bind(&Client::KeyError, base::Unretained(&client_)), | 186 base::Bind(&Client::KeyError, base::Unretained(&client_)), |
| 197 base::Bind(&Client::KeyMessage, base::Unretained(&client_)), | 187 base::Bind(&Client::KeyMessage, base::Unretained(&client_))), |
| 198 base::Bind(&Client::NeedKey, base::Unretained(&client_))), | |
| 199 host_(host), | 188 host_(host), |
| 200 timer_delay_ms_(kInitialTimerDelayMs), | 189 timer_delay_ms_(kInitialTimerDelayMs), |
| 201 timer_set_(false) { | 190 timer_set_(false) { |
| 202 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) | 191 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) |
| 203 channel_count_ = 0; | 192 channel_count_ = 0; |
| 204 bits_per_channel_ = 0; | 193 bits_per_channel_ = 0; |
| 205 samples_per_second_ = 0; | 194 samples_per_second_ = 0; |
| 206 output_timestamp_base_in_microseconds_ = kNoTimestamp; | 195 output_timestamp_base_in_microseconds_ = kNoTimestamp; |
| 207 total_samples_generated_ = 0; | 196 total_samples_generated_ = 0; |
| 208 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | 197 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 int samples_generated = GenerateFakeAudioFramesFromDuration( | 548 int samples_generated = GenerateFakeAudioFramesFromDuration( |
| 560 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(), | 549 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(), |
| 561 audio_frames); | 550 audio_frames); |
| 562 total_samples_generated_ += samples_generated; | 551 total_samples_generated_ += samples_generated; |
| 563 | 552 |
| 564 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; | 553 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; |
| 565 } | 554 } |
| 566 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | 555 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER |
| 567 | 556 |
| 568 } // namespace webkit_media | 557 } // namespace webkit_media |
| OLD | NEW |