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

Side by Side Diff: webkit/media/crypto/ppapi/clear_key_cdm.cc

Issue 11469040: EME v0.1: Report defaultURL in KeyMessage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates and added test 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 session_id_ = session_id; 168 session_id_ = session_id;
169 } 169 }
170 170
171 void ClearKeyCdm::Client::KeyMessage(const std::string& key_system, 171 void ClearKeyCdm::Client::KeyMessage(const std::string& key_system,
172 const std::string& session_id, 172 const std::string& session_id,
173 const std::string& message, 173 const std::string& message,
174 const std::string& default_url) { 174 const std::string& default_url) {
175 status_ = kKeyMessage; 175 status_ = kKeyMessage;
176 session_id_ = session_id; 176 session_id_ = session_id;
177 key_message_ = message; 177 key_message_ = message;
178 default_url_ = default_url;
178 } 179 }
179 180
180 void ClearKeyCdm::Client::NeedKey(const std::string& key_system, 181 void ClearKeyCdm::Client::NeedKey(const std::string& key_system,
181 const std::string& session_id, 182 const std::string& session_id,
182 const std::string& type, 183 const std::string& type,
183 scoped_array<uint8> init_data, 184 scoped_array<uint8> init_data,
184 int init_data_length) { 185 int init_data_length) {
185 // In the current implementation of AesDecryptor, NeedKey is not used. 186 // In the current implementation of AesDecryptor, NeedKey is not used.
186 // If no key is available to decrypt an input buffer, it returns kNoKey to 187 // If no key is available to decrypt an input buffer, it returns kNoKey to
187 // the caller instead of firing NeedKey. 188 // the caller instead of firing NeedKey.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 cdm::Status ClearKeyCdm::CancelKeyRequest(const char* session_id, 259 cdm::Status ClearKeyCdm::CancelKeyRequest(const char* session_id,
259 int session_id_size) { 260 int session_id_size) {
260 DVLOG(1) << "CancelKeyRequest()"; 261 DVLOG(1) << "CancelKeyRequest()";
261 base::AutoLock auto_lock(client_lock_); 262 base::AutoLock auto_lock(client_lock_);
262 ScopedResetter<Client> auto_resetter(&client_); 263 ScopedResetter<Client> auto_resetter(&client_);
263 decryptor_.CancelKeyRequest("", std::string(session_id, session_id_size)); 264 decryptor_.CancelKeyRequest("", std::string(session_id, session_id_size));
264 return cdm::kSuccess; 265 return cdm::kSuccess;
265 } 266 }
266 267
267 void ClearKeyCdm::TimerExpired(void* context) { 268 void ClearKeyCdm::TimerExpired(void* context) {
268 std::string heartbeat_message = 269 std::string heartbeat_message =
scherkus (not reviewing) 2012/12/14 21:45:26 using ?: is great 'n all if it fits on one line, b
ddorwin 2012/12/14 21:55:16 Done.
269 (!next_heartbeat_message_.empty() && 270 (!next_heartbeat_message_.empty() &&
270 context == &next_heartbeat_message_[0]) ? 271 context == &next_heartbeat_message_[0]) ?
271 next_heartbeat_message_ : 272 next_heartbeat_message_ :
272 "ERROR: Invalid timer context found!"; 273 "ERROR: Invalid timer context found!";
273 274
275 // This URL is only used for testing the code path for defaultURL.
276 // There is no service at this URL, so applications should ignore it.
277 const char url[] = "http://test.externalclearkey.chromium.org";
278
274 host_->SendKeyMessage( 279 host_->SendKeyMessage(
275 heartbeat_session_id_.data(), heartbeat_session_id_.size(), 280 heartbeat_session_id_.data(), heartbeat_session_id_.size(),
276 heartbeat_message.data(), heartbeat_message.size(), 281 heartbeat_message.data(), heartbeat_message.size(),
277 NULL, 0); 282 url, arraysize(url) - 1);
278 283
279 ScheduleNextHeartBeat(); 284 ScheduleNextHeartBeat();
280 } 285 }
281 286
282 static void CopyDecryptResults( 287 static void CopyDecryptResults(
283 media::Decryptor::Status* status_copy, 288 media::Decryptor::Status* status_copy,
284 scoped_refptr<media::DecoderBuffer>* buffer_copy, 289 scoped_refptr<media::DecoderBuffer>* buffer_copy,
285 media::Decryptor::Status status, 290 media::Decryptor::Status status,
286 const scoped_refptr<media::DecoderBuffer>& buffer) { 291 const scoped_refptr<media::DecoderBuffer>& buffer) {
287 *status_copy = status; 292 *status_copy = status;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 int samples_generated = GenerateFakeAudioFramesFromDuration( 540 int samples_generated = GenerateFakeAudioFramesFromDuration(
536 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(), 541 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(),
537 audio_frames); 542 audio_frames);
538 total_samples_generated_ += samples_generated; 543 total_samples_generated_ += samples_generated;
539 544
540 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; 545 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess;
541 } 546 }
542 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER 547 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
543 548
544 } // namespace webkit_media 549 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698