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

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

Issue 11226019: Encrypted Media: Replace DecryptorClient with key event callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add spec link 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
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 const std::string& type, 183 const std::string& type,
184 scoped_array<uint8> init_data, 184 scoped_array<uint8> init_data,
185 int init_data_length) { 185 int init_data_length) {
186 // In the current implementation of AesDecryptor, NeedKey is not used. 186 // In the current implementation of AesDecryptor, NeedKey is not used.
187 // 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
188 // the caller instead of firing NeedKey. 188 // the caller instead of firing NeedKey.
189 NOTREACHED(); 189 NOTREACHED();
190 } 190 }
191 191
192 ClearKeyCdm::ClearKeyCdm(cdm::Allocator* allocator, cdm::Host* host) 192 ClearKeyCdm::ClearKeyCdm(cdm::Allocator* allocator, cdm::Host* host)
193 : decryptor_(&client_), 193 : decryptor_(base::Bind(&Client::KeyAdded, base::Unretained(&client_)),
194 base::Bind(&Client::KeyError, base::Unretained(&client_)),
195 base::Bind(&Client::KeyMessage, base::Unretained(&client_)),
196 base::Bind(&Client::NeedKey, base::Unretained(&client_))),
194 allocator_(allocator), 197 allocator_(allocator),
195 host_(host), 198 host_(host),
196 timer_delay_ms_(kInitialTimerDelayMs), 199 timer_delay_ms_(kInitialTimerDelayMs),
197 timer_set_(false) { 200 timer_set_(false) {
198 DCHECK(allocator_); 201 DCHECK(allocator_);
199 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) 202 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER)
200 channel_count_ = 0; 203 channel_count_ = 0;
201 bits_per_channel_ = 0; 204 bits_per_channel_ = 0;
202 samples_per_second_ = 0; 205 samples_per_second_ = 0;
203 output_timestamp_base_in_microseconds_ = kNoTimestamp; 206 output_timestamp_base_in_microseconds_ = kNoTimestamp;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 int samples_generated = GenerateFakeAudioFramesFromDuration( 545 int samples_generated = GenerateFakeAudioFramesFromDuration(
543 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(), 546 timestamp_in_microseconds - CurrentTimeStampInMicroseconds(),
544 audio_frames); 547 audio_frames);
545 total_samples_generated_ += samples_generated; 548 total_samples_generated_ += samples_generated;
546 549
547 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; 550 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess;
548 } 551 }
549 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER 552 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
550 553
551 } // namespace webkit_media 554 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698