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

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

Issue 2580093002: Revert of Convert USE_PROPRIETARY_CODECS to a buildflag header. (Closed)
Patch Set: Created 4 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
« 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"
27 26
28 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 27 #if defined(USE_PROPRIETARY_CODECS)
29 #include "media/cdm/cenc_utils.h" 28 #include "media/cdm/cenc_utils.h"
30 #endif 29 #endif
31 30
32 namespace media { 31 namespace media {
33 32
34 // Keeps track of the session IDs and DecryptionKeys. The keys are ordered by 33 // Keeps track of the session IDs and DecryptionKeys. The keys are ordered by
35 // insertion time (last insertion is first). It takes ownership of the 34 // insertion time (last insertion is first). It takes ownership of the
36 // DecryptionKeys. 35 // DecryptionKeys.
37 class AesDecryptor::SessionIdDecryptionKeyMap { 36 class AesDecryptor::SessionIdDecryptionKeyMap {
38 // Use a std::list to actually hold the data. Insertion is always done 37 // 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
273 case EmeInitDataType::WEBM: 272 case EmeInitDataType::WEBM:
274 // |init_data| is simply the key needed. 273 // |init_data| is simply the key needed.
275 if (init_data.size() < limits::kMinKeyIdLength || 274 if (init_data.size() < limits::kMinKeyIdLength ||
276 init_data.size() > limits::kMaxKeyIdLength) { 275 init_data.size() > limits::kMaxKeyIdLength) {
277 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0, "Incorrect length"); 276 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0, "Incorrect length");
278 return; 277 return;
279 } 278 }
280 keys.push_back(init_data); 279 keys.push_back(init_data);
281 break; 280 break;
282 case EmeInitDataType::CENC: 281 case EmeInitDataType::CENC:
283 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 282 #if defined(USE_PROPRIETARY_CODECS)
284 // |init_data| is a set of 0 or more concatenated 'pssh' boxes. 283 // |init_data| is a set of 0 or more concatenated 'pssh' boxes.
285 if (!GetKeyIdsForCommonSystemId(init_data, &keys)) { 284 if (!GetKeyIdsForCommonSystemId(init_data, &keys)) {
286 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0, 285 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0,
287 "No supported PSSH box found."); 286 "No supported PSSH box found.");
288 return; 287 return;
289 } 288 }
290 break; 289 break;
291 #else 290 #else
292 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0, 291 promise->reject(CdmPromise::NOT_SUPPORTED_ERROR, 0,
293 "Initialization data type CENC is not supported."); 292 "Initialization data type CENC is not supported.");
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 bool AesDecryptor::DecryptionKey::Init() { 616 bool AesDecryptor::DecryptionKey::Init() {
618 CHECK(!secret_.empty()); 617 CHECK(!secret_.empty());
619 decryption_key_ = 618 decryption_key_ =
620 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); 619 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_);
621 if (!decryption_key_) 620 if (!decryption_key_)
622 return false; 621 return false;
623 return true; 622 return true;
624 } 623 }
625 624
626 } // namespace media 625 } // 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