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

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: 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
« no previous file with comments | « no previous file | webkit/media/webmediaplayer_impl.h » ('j') | webkit/media/webmediaplayer_proxy.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 void ClearKeyCdm::Client::KeyMessage(const std::string& key_system, 179 void ClearKeyCdm::Client::KeyMessage(const std::string& key_system,
180 const std::string& session_id, 180 const std::string& session_id,
181 scoped_array<uint8> message, 181 scoped_array<uint8> message,
182 int message_length, 182 int message_length,
183 const std::string& default_url) { 183 const std::string& default_url) {
184 status_ = kKeyMessage; 184 status_ = kKeyMessage;
185 session_id_ = session_id; 185 session_id_ = session_id;
186 key_message_ = message.Pass(); 186 key_message_ = message.Pass();
187 key_message_length_ = message_length; 187 key_message_length_ = message_length;
188 default_url_ = default_url;
188 } 189 }
189 190
190 void ClearKeyCdm::Client::NeedKey(const std::string& key_system, 191 void ClearKeyCdm::Client::NeedKey(const std::string& key_system,
191 const std::string& session_id, 192 const std::string& session_id,
192 const std::string& type, 193 const std::string& type,
193 scoped_array<uint8> init_data, 194 scoped_array<uint8> init_data,
194 int init_data_length) { 195 int init_data_length) {
195 // In the current implementation of AesDecryptor, NeedKey is not used. 196 // In the current implementation of AesDecryptor, NeedKey is not used.
196 // If no key is available to decrypt an input buffer, it returns kNoKey to 197 // If no key is available to decrypt an input buffer, it returns kNoKey to
197 // the caller instead of firing NeedKey. 198 // the caller instead of firing NeedKey.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 287
287 void ClearKeyCdm::TimerExpired(cdm::KeyMessage* msg, bool* populated) { 288 void ClearKeyCdm::TimerExpired(cdm::KeyMessage* msg, bool* populated) {
288 std::ostringstream msg_stream; 289 std::ostringstream msg_stream;
289 msg_stream << kHeartBeatHeader << " from ClearKey CDM at time " 290 msg_stream << kHeartBeatHeader << " from ClearKey CDM at time "
290 << cdm_host_->GetCurrentWallTimeInSeconds() << "."; 291 << cdm_host_->GetCurrentWallTimeInSeconds() << ".";
291 std::string msg_string = msg_stream.str(); 292 std::string msg_string = msg_stream.str();
292 293
293 msg->set_message(allocator_->Allocate(msg_string.length())); 294 msg->set_message(allocator_->Allocate(msg_string.length()));
294 memcpy(msg->message()->data(), msg_string.data(), msg_string.length()); 295 memcpy(msg->message()->data(), msg_string.data(), msg_string.length());
295 msg->set_session_id(latest_session_id_.data(), latest_session_id_.length()); 296 msg->set_session_id(latest_session_id_.data(), latest_session_id_.length());
296 msg->set_default_url(NULL, 0); 297 const char url[] = "http://externalclearkey.chromium.org";
298 msg->set_default_url(url, arraysize(url));
297 299
298 *populated = true; 300 *populated = true;
299 301
300 cdm_host_->SetTimer(timer_delay_ms_); 302 cdm_host_->SetTimer(timer_delay_ms_);
301 303
302 // Use a smaller timer delay at start-up to facilitate testing. Increase the 304 // Use a smaller timer delay at start-up to facilitate testing. Increase the
303 // timer delay up to a limit to avoid message spam. 305 // timer delay up to a limit to avoid message spam.
304 if (timer_delay_ms_ < kMaxTimerDelayMs) 306 if (timer_delay_ms_ < kMaxTimerDelayMs)
305 timer_delay_ms_ = std::min(2 * timer_delay_ms_, kMaxTimerDelayMs); 307 timer_delay_ms_ = std::min(2 * timer_delay_ms_, kMaxTimerDelayMs);
306 } 308 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 int samples_generated = GenerateFakeAudioFramesFromDuration( 544 int samples_generated = GenerateFakeAudioFramesFromDuration(
543 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(), 545 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(),
544 audio_frames); 546 audio_frames);
545 total_samples_generated_ += samples_generated; 547 total_samples_generated_ += samples_generated;
546 548
547 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; 549 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess;
548 } 550 }
549 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER 551 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
550 552
551 } // namespace webkit_media 553 } // namespace webkit_media
OLDNEW
« no previous file with comments | « no previous file | webkit/media/webmediaplayer_impl.h » ('j') | webkit/media/webmediaplayer_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698