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 "webkit/media/crypto/ppapi/clear_key_cdm.h" | 5 #include "webkit/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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 cdm::Status ClearKeyCdm::AddKey(const char* session_id, | 243 cdm::Status ClearKeyCdm::AddKey(const char* session_id, |
244 int session_id_size, | 244 int session_id_size, |
245 const uint8_t* key, | 245 const uint8_t* key, |
246 int key_size, | 246 int key_size, |
247 const uint8_t* key_id, | 247 const uint8_t* key_id, |
248 int key_id_size) { | 248 int key_id_size) { |
249 DVLOG(1) << "AddKey()"; | 249 DVLOG(1) << "AddKey()"; |
250 base::AutoLock auto_lock(client_lock_); | 250 base::AutoLock auto_lock(client_lock_); |
251 ScopedResetter<Client> auto_resetter(&client_); | 251 ScopedResetter<Client> auto_resetter(&client_); |
252 decryptor_.AddKey("", key, key_size, key_id, key_id_size, | 252 decryptor_.AddKey(std::string(), |
| 253 key, |
| 254 key_size, |
| 255 key_id, |
| 256 key_id_size, |
253 std::string(session_id, session_id_size)); | 257 std::string(session_id, session_id_size)); |
254 | 258 |
255 if (client_.status() != Client::kKeyAdded) | 259 if (client_.status() != Client::kKeyAdded) |
256 return cdm::kSessionError; | 260 return cdm::kSessionError; |
257 | 261 |
258 if (!timer_set_) { | 262 if (!timer_set_) { |
259 ScheduleNextHeartBeat(); | 263 ScheduleNextHeartBeat(); |
260 timer_set_ = true; | 264 timer_set_ = true; |
261 } | 265 } |
262 | 266 |
263 return cdm::kSuccess; | 267 return cdm::kSuccess; |
264 } | 268 } |
265 | 269 |
266 cdm::Status ClearKeyCdm::CancelKeyRequest(const char* session_id, | 270 cdm::Status ClearKeyCdm::CancelKeyRequest(const char* session_id, |
267 int session_id_size) { | 271 int session_id_size) { |
268 DVLOG(1) << "CancelKeyRequest()"; | 272 DVLOG(1) << "CancelKeyRequest()"; |
269 base::AutoLock auto_lock(client_lock_); | 273 base::AutoLock auto_lock(client_lock_); |
270 ScopedResetter<Client> auto_resetter(&client_); | 274 ScopedResetter<Client> auto_resetter(&client_); |
271 decryptor_.CancelKeyRequest("", std::string(session_id, session_id_size)); | 275 decryptor_.CancelKeyRequest(std::string(), |
| 276 std::string(session_id, session_id_size)); |
272 return cdm::kSuccess; | 277 return cdm::kSuccess; |
273 } | 278 } |
274 | 279 |
275 void ClearKeyCdm::TimerExpired(void* context) { | 280 void ClearKeyCdm::TimerExpired(void* context) { |
276 std::string heartbeat_message; | 281 std::string heartbeat_message; |
277 if (!next_heartbeat_message_.empty() && | 282 if (!next_heartbeat_message_.empty() && |
278 context == &next_heartbeat_message_[0]) { | 283 context == &next_heartbeat_message_[0]) { |
279 heartbeat_message = next_heartbeat_message_; | 284 heartbeat_message = next_heartbeat_message_; |
280 } else { | 285 } else { |
281 heartbeat_message = "ERROR: Invalid timer context found!"; | 286 heartbeat_message = "ERROR: Invalid timer context found!"; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 int samples_generated = GenerateFakeAudioFramesFromDuration( | 569 int samples_generated = GenerateFakeAudioFramesFromDuration( |
565 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(), | 570 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(), |
566 audio_frames); | 571 audio_frames); |
567 total_samples_generated_ += samples_generated; | 572 total_samples_generated_ += samples_generated; |
568 | 573 |
569 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; | 574 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; |
570 } | 575 } |
571 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | 576 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER |
572 | 577 |
573 } // namespace webkit_media | 578 } // namespace webkit_media |
OLD | NEW |