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

Side by Side Diff: media/crypto/aes_decryptor.cc

Issue 10969028: Add video decoding methods in Decryptor and add DecryptingVideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reorder methods in the unittest Created 8 years, 2 months 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 | « media/crypto/aes_decryptor.h ('k') | media/filters/decrypting_video_decoder.h » ('j') | no next file with comments »
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 "media/crypto/aes_decryptor.h" 5 #include "media/crypto/aes_decryptor.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "crypto/encryptor.h" 12 #include "crypto/encryptor.h"
13 #include "crypto/symmetric_key.h" 13 #include "crypto/symmetric_key.h"
14 #include "media/base/decoder_buffer.h" 14 #include "media/base/decoder_buffer.h"
15 #include "media/base/decrypt_config.h" 15 #include "media/base/decrypt_config.h"
16 #include "media/base/decryptor_client.h" 16 #include "media/base/decryptor_client.h"
17 #include "media/base/video_decoder_config.h"
18 #include "media/base/video_frame.h"
17 19
18 namespace media { 20 namespace media {
19 21
20 uint32 AesDecryptor::next_session_id_ = 1; 22 uint32 AesDecryptor::next_session_id_ = 1;
21 23
22 enum ClearBytesBufferSel { 24 enum ClearBytesBufferSel {
23 kSrcContainsClearBytes, 25 kSrcContainsClearBytes,
24 kDstContainsClearBytes 26 kDstContainsClearBytes
25 }; 27 };
26 28
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 227 }
226 228
227 decrypted->SetTimestamp(encrypted->GetTimestamp()); 229 decrypted->SetTimestamp(encrypted->GetTimestamp());
228 decrypted->SetDuration(encrypted->GetDuration()); 230 decrypted->SetDuration(encrypted->GetDuration());
229 decrypt_cb.Run(kSuccess, decrypted); 231 decrypt_cb.Run(kSuccess, decrypted);
230 } 232 }
231 233
232 void AesDecryptor::CancelDecrypt() { 234 void AesDecryptor::CancelDecrypt() {
233 } 235 }
234 236
237 void AesDecryptor::InitializeVideoDecoder(const VideoDecoderConfig& config,
238 const DecoderInitCB& init_cb) {
239 // AesDecryptor does not support video decoding. Always return false here.
240 init_cb.Run(false);
241 }
242
243 void AesDecryptor::DecryptAndDecodeVideo(
244 const scoped_refptr<DecoderBuffer>& encrypted,
245 const VideoDecodeCB& video_decode_cb) {
246 NOTREACHED() << "AesDecryptor does not support video decoding";
247 video_decode_cb.Run(kError, NULL);
248 }
249
250 void AesDecryptor::CancelDecryptAndDecodeVideo() {
251 NOTREACHED() << "AesDecryptor does not support video decoding";
252 }
253
254 void AesDecryptor::StopVideoDecoder() {
255 NOTREACHED() << "AesDecryptor does not support video decoding";
256 }
257
235 void AesDecryptor::SetKey(const std::string& key_id, 258 void AesDecryptor::SetKey(const std::string& key_id,
236 scoped_ptr<DecryptionKey> decryption_key) { 259 scoped_ptr<DecryptionKey> decryption_key) {
237 base::AutoLock auto_lock(key_map_lock_); 260 base::AutoLock auto_lock(key_map_lock_);
238 KeyMap::iterator found = key_map_.find(key_id); 261 KeyMap::iterator found = key_map_.find(key_id);
239 if (found != key_map_.end()) { 262 if (found != key_map_.end()) {
240 delete found->second; 263 delete found->second;
241 key_map_.erase(found); 264 key_map_.erase(found);
242 } 265 }
243 key_map_[key_id] = decryption_key.release(); 266 key_map_[key_id] = decryption_key.release();
244 } 267 }
(...skipping 17 matching lines...) Expand all
262 bool AesDecryptor::DecryptionKey::Init() { 285 bool AesDecryptor::DecryptionKey::Init() {
263 CHECK(!secret_.empty()); 286 CHECK(!secret_.empty());
264 decryption_key_.reset(crypto::SymmetricKey::Import( 287 decryption_key_.reset(crypto::SymmetricKey::Import(
265 crypto::SymmetricKey::AES, secret_)); 288 crypto::SymmetricKey::AES, secret_));
266 if (!decryption_key_.get()) 289 if (!decryption_key_.get())
267 return false; 290 return false;
268 return true; 291 return true;
269 } 292 }
270 293
271 } // namespace media 294 } // namespace media
OLDNEW
« no previous file with comments | « media/crypto/aes_decryptor.h ('k') | media/filters/decrypting_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698