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

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

Issue 1123343007: iOS experiments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added media_blink dependency on media_mime_util Created 5 years, 7 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/blink/BUILD.gn ('k') | media/blink/media_blink.gyp » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "key_system_config_selector.h" 5 #include "key_system_config_selector.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "build/build_config.h"
11 #include "media/base/key_systems.h" 12 #include "media/base/key_systems.h"
12 #include "media/base/media_permission.h" 13 #include "media/base/media_permission.h"
14 #include "media/base/mime_util.h"
13 #include "media/blink/webmediaplayer_util.h" 15 #include "media/blink/webmediaplayer_util.h"
14 #include "net/base/mime_util.h"
15 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h" 16 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h"
16 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 17 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
17 #include "third_party/WebKit/public/platform/WebString.h" 18 #include "third_party/WebKit/public/platform/WebString.h"
18 #include "third_party/WebKit/public/platform/WebVector.h" 19 #include "third_party/WebKit/public/platform/WebVector.h"
19 #include "url/gurl.h" 20 #include "url/gurl.h"
20 21
21 namespace media { 22 namespace media {
22 23
23 using EmeFeatureRequirement = 24 using EmeFeatureRequirement =
24 blink::WebMediaKeySystemConfiguration::Requirement; 25 blink::WebMediaKeySystemConfiguration::Requirement;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 const std::string& key_system, 277 const std::string& key_system,
277 EmeMediaType media_type, 278 EmeMediaType media_type,
278 const std::string& container_mime_type, 279 const std::string& container_mime_type,
279 const std::string& codecs, 280 const std::string& codecs,
280 KeySystemConfigSelector::ConfigState* config_state) { 281 KeySystemConfigSelector::ConfigState* config_state) {
281 // TODO(sandersd): Move contentType parsing from Blink to here so that invalid 282 // TODO(sandersd): Move contentType parsing from Blink to here so that invalid
282 // parameters can be rejected. http://crbug.com/417561 283 // parameters can be rejected. http://crbug.com/417561
283 std::string container_lower = base::StringToLowerASCII(container_mime_type); 284 std::string container_lower = base::StringToLowerASCII(container_mime_type);
284 285
285 // Check that |container_mime_type| is supported by Chrome. 286 // Check that |container_mime_type| is supported by Chrome.
286 if (!net::IsSupportedMediaMimeType(container_lower)) 287 if (!media::IsSupportedMediaMimeType(container_lower))
287 return false; 288 return false;
288 289
289 // Check that |codecs| are supported by Chrome. This is done primarily to 290 // Check that |codecs| are supported by Chrome. This is done primarily to
290 // validate extended codecs, but it also ensures that the CDM cannot support 291 // validate extended codecs, but it also ensures that the CDM cannot support
291 // codecs that Chrome does not (which could complicate the robustness 292 // codecs that Chrome does not (which could complicate the robustness
292 // algorithm). 293 // algorithm).
293 std::vector<std::string> codec_vector; 294 std::vector<std::string> codec_vector;
294 net::ParseCodecString(codecs, &codec_vector, false); 295 media::ParseCodecString(codecs, &codec_vector, false);
295 if (!codec_vector.empty() && 296 if (!codec_vector.empty() &&
296 (net::IsSupportedStrictMediaMimeType(container_lower, codec_vector) != 297 (media::IsSupportedStrictMediaMimeType(container_lower, codec_vector) !=
297 net::IsSupported)) { 298 media::IsSupported)) {
298 return false; 299 return false;
299 } 300 }
300 301
301 // Check that |container_mime_type| and |codecs| are supported by the CDM. 302 // Check that |container_mime_type| and |codecs| are supported by the CDM.
302 // This check does not handle extended codecs, so extended codec information 303 // This check does not handle extended codecs, so extended codec information
303 // is stripped (extended codec information was checked above). 304 // is stripped (extended codec information was checked above).
304 std::vector<std::string> stripped_codec_vector; 305 std::vector<std::string> stripped_codec_vector;
305 net::ParseCodecString(codecs, &stripped_codec_vector, true); 306 media::ParseCodecString(codecs, &stripped_codec_vector, true);
306 EmeConfigRule codecs_rule = key_systems_->GetContentTypeConfigRule( 307 EmeConfigRule codecs_rule = key_systems_->GetContentTypeConfigRule(
307 key_system, media_type, container_lower, stripped_codec_vector); 308 key_system, media_type, container_lower, stripped_codec_vector);
308 if (!config_state->IsRuleSupported(codecs_rule)) 309 if (!config_state->IsRuleSupported(codecs_rule))
309 return false; 310 return false;
310 config_state->AddRule(codecs_rule); 311 config_state->AddRule(codecs_rule);
311 312
312 return true; 313 return true;
313 } 314 }
314 315
315 bool KeySystemConfigSelector::GetSupportedCapabilities( 316 bool KeySystemConfigSelector::GetSupportedCapabilities(
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 755
755 void KeySystemConfigSelector::OnPermissionResult( 756 void KeySystemConfigSelector::OnPermissionResult(
756 scoped_ptr<SelectionRequest> request, 757 scoped_ptr<SelectionRequest> request,
757 bool is_permission_granted) { 758 bool is_permission_granted) {
758 request->was_permission_requested = true; 759 request->was_permission_requested = true;
759 request->is_permission_granted = is_permission_granted; 760 request->is_permission_granted = is_permission_granted;
760 SelectConfigInternal(request.Pass()); 761 SelectConfigInternal(request.Pass());
761 } 762 }
762 763
763 } // namespace media 764 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/BUILD.gn ('k') | media/blink/media_blink.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698