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

Side by Side Diff: media/blink/webcontentdecryptionmodulesession_impl.cc

Issue 2572883002: Convert USE_PROPRIETARY_CODECS to a buildflag header. (Closed)
Patch Set: Merge 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/base/mime_util_unittest.cc ('k') | media/cast/sender/h264_vt_encoder_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 "webcontentdecryptionmodulesession_impl.h" 5 #include "webcontentdecryptionmodulesession_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/numerics/safe_conversions.h" 11 #include "base/numerics/safe_conversions.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "media/base/cdm_key_information.h" 14 #include "media/base/cdm_key_information.h"
15 #include "media/base/cdm_promise.h" 15 #include "media/base/cdm_promise.h"
16 #include "media/base/content_decryption_module.h" 16 #include "media/base/content_decryption_module.h"
17 #include "media/base/key_system_names.h" 17 #include "media/base/key_system_names.h"
18 #include "media/base/key_systems.h" 18 #include "media/base/key_systems.h"
19 #include "media/base/limits.h" 19 #include "media/base/limits.h"
20 #include "media/blink/cdm_result_promise.h" 20 #include "media/blink/cdm_result_promise.h"
21 #include "media/blink/cdm_session_adapter.h" 21 #include "media/blink/cdm_session_adapter.h"
22 #include "media/blink/webmediaplayer_util.h" 22 #include "media/blink/webmediaplayer_util.h"
23 #include "media/cdm/json_web_key.h" 23 #include "media/cdm/json_web_key.h"
24 #include "media/media_features.h"
24 #include "third_party/WebKit/public/platform/WebData.h" 25 #include "third_party/WebKit/public/platform/WebData.h"
25 #include "third_party/WebKit/public/platform/WebEncryptedMediaKeyInformation.h" 26 #include "third_party/WebKit/public/platform/WebEncryptedMediaKeyInformation.h"
26 #include "third_party/WebKit/public/platform/WebString.h" 27 #include "third_party/WebKit/public/platform/WebString.h"
27 #include "third_party/WebKit/public/platform/WebURL.h" 28 #include "third_party/WebKit/public/platform/WebURL.h"
28 #include "third_party/WebKit/public/platform/WebVector.h" 29 #include "third_party/WebKit/public/platform/WebVector.h"
29 30
30 #if defined(USE_PROPRIETARY_CODECS) 31 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
31 #include "media/cdm/cenc_utils.h" 32 #include "media/cdm/cenc_utils.h"
32 #endif 33 #endif
33 34
34 namespace media { 35 namespace media {
35 36
36 namespace { 37 namespace {
37 38
38 const char kCloseSessionUMAName[] = "CloseSession"; 39 const char kCloseSessionUMAName[] = "CloseSession";
39 const char kGenerateRequestUMAName[] = "GenerateRequest"; 40 const char kGenerateRequestUMAName[] = "GenerateRequest";
40 const char kLoadSessionUMAName[] = "LoadSession"; 41 const char kLoadSessionUMAName[] = "LoadSession";
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 case EmeInitDataType::WEBM: 118 case EmeInitDataType::WEBM:
118 // |init_data| for WebM is a single key. 119 // |init_data| for WebM is a single key.
119 if (init_data_length > limits::kMaxKeyIdLength) { 120 if (init_data_length > limits::kMaxKeyIdLength) {
120 error_message->assign("Initialization data for WebM is too long."); 121 error_message->assign("Initialization data for WebM is too long.");
121 return false; 122 return false;
122 } 123 }
123 sanitized_init_data->assign(init_data, init_data + init_data_length); 124 sanitized_init_data->assign(init_data, init_data + init_data_length);
124 return true; 125 return true;
125 126
126 case EmeInitDataType::CENC: 127 case EmeInitDataType::CENC:
127 #if defined(USE_PROPRIETARY_CODECS) 128 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
128 sanitized_init_data->assign(init_data, init_data + init_data_length); 129 sanitized_init_data->assign(init_data, init_data + init_data_length);
129 if (!ValidatePsshInput(*sanitized_init_data)) { 130 if (!ValidatePsshInput(*sanitized_init_data)) {
130 error_message->assign("Initialization data for CENC is incorrect."); 131 error_message->assign("Initialization data for CENC is incorrect.");
131 return false; 132 return false;
132 } 133 }
133 return true; 134 return true;
134 #else 135 #else
135 error_message->assign("Initialization data type CENC is not supported."); 136 error_message->assign("Initialization data type CENC is not supported.");
136 return false; 137 return false;
137 #endif 138 #endif
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 522
522 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; 523 DCHECK(session_id_.empty()) << "Session ID may not be changed once set.";
523 session_id_ = session_id; 524 session_id_ = session_id;
524 *status = 525 *status =
525 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) 526 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr())
526 ? SessionInitStatus::NEW_SESSION 527 ? SessionInitStatus::NEW_SESSION
527 : SessionInitStatus::SESSION_ALREADY_EXISTS; 528 : SessionInitStatus::SESSION_ALREADY_EXISTS;
528 } 529 }
529 530
530 } // namespace media 531 } // namespace media
OLDNEW
« no previous file with comments | « media/base/mime_util_unittest.cc ('k') | media/cast/sender/h264_vt_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698