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

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

Issue 2643333002: Convert USE_PROPRIETARY_CODECS to a buildflag header. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « media/cast/sender/h264_vt_encoder_unittest.cc ('k') | media/cdm/aes_decryptor_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/cdm/aes_decryptor.h" 5 #include "media/cdm/aes_decryptor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <list> 8 #include <list>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "crypto/encryptor.h" 15 #include "crypto/encryptor.h"
16 #include "crypto/symmetric_key.h" 16 #include "crypto/symmetric_key.h"
17 #include "media/base/audio_decoder_config.h" 17 #include "media/base/audio_decoder_config.h"
18 #include "media/base/cdm_key_information.h" 18 #include "media/base/cdm_key_information.h"
19 #include "media/base/cdm_promise.h" 19 #include "media/base/cdm_promise.h"
20 #include "media/base/decoder_buffer.h" 20 #include "media/base/decoder_buffer.h"
21 #include "media/base/decrypt_config.h" 21 #include "media/base/decrypt_config.h"
22 #include "media/base/limits.h" 22 #include "media/base/limits.h"
23 #include "media/base/video_decoder_config.h" 23 #include "media/base/video_decoder_config.h"
24 #include "media/base/video_frame.h" 24 #include "media/base/video_frame.h"
25 #include "media/cdm/json_web_key.h" 25 #include "media/cdm/json_web_key.h"
26 #include "media/media_features.h"
26 27
27 #if defined(USE_PROPRIETARY_CODECS) 28 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
28 #include "media/cdm/cenc_utils.h" 29 #include "media/cdm/cenc_utils.h"
29 #endif 30 #endif
30 31
31 namespace media { 32 namespace media {
32 33
33 // Keeps track of the session IDs and DecryptionKeys. The keys are ordered by 34 // Keeps track of the session IDs and DecryptionKeys. The keys are ordered by
34 // insertion time (last insertion is first). It takes ownership of the 35 // insertion time (last insertion is first). It takes ownership of the
35 // DecryptionKeys. 36 // DecryptionKeys.
36 class AesDecryptor::SessionIdDecryptionKeyMap { 37 class AesDecryptor::SessionIdDecryptionKeyMap {
37 // Use a std::list to actually hold the data. Insertion is always done 38 // Use a std::list to actually hold the data. Insertion is always done
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 case EmeInitDataType::WEBM: 273 case EmeInitDataType::WEBM:
273 // |init_data| is simply the key needed. 274 // |init_data| is simply the key needed.
274 if (init_data.size() < limits::kMinKeyIdLength || 275 if (init_data.size() < limits::kMinKeyIdLength ||
275 init_data.size() > limits::kMaxKeyIdLength) { 276 init_data.size() > limits::kMaxKeyIdLength) {
276 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0, "Incorrect length"); 277 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0, "Incorrect length");
277 return; 278 return;
278 } 279 }
279 keys.push_back(init_data); 280 keys.push_back(init_data);
280 break; 281 break;
281 case EmeInitDataType::CENC: 282 case EmeInitDataType::CENC:
282 #if defined(USE_PROPRIETARY_CODECS) 283 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
283 // |init_data| is a set of 0 or more concatenated 'pssh' boxes. 284 // |init_data| is a set of 0 or more concatenated 'pssh' boxes.
284 if (!GetKeyIdsForCommonSystemId(init_data, &keys)) { 285 if (!GetKeyIdsForCommonSystemId(init_data, &keys)) {
285 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0, 286 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0,
286 "No supported PSSH box found."); 287 "No supported PSSH box found.");
287 return; 288 return;
288 } 289 }
289 break; 290 break;
290 #else 291 #else
291 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0, 292 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0,
292 "Initialization data type CENC is not supported."); 293 "Initialization data type CENC is not supported.");
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 bool AesDecryptor::DecryptionKey::Init() { 617 bool AesDecryptor::DecryptionKey::Init() {
617 CHECK(!secret_.empty()); 618 CHECK(!secret_.empty());
618 decryption_key_ = 619 decryption_key_ =
619 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); 620 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_);
620 if (!decryption_key_) 621 if (!decryption_key_)
621 return false; 622 return false;
622 return true; 623 return true;
623 } 624 }
624 625
625 } // namespace media 626 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/h264_vt_encoder_unittest.cc ('k') | media/cdm/aes_decryptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698