OLD | NEW |
---|---|
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" | |
Ryan Sleevi
2015/05/13 23:55:53
Unclear why this is added? no ifdefs?
servolk
2015/05/14 00:13:23
There was a comment by ddorwin@ in patchset #9 to
| |
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 Loading... | |
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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 | 761 |
761 void KeySystemConfigSelector::OnPermissionResult( | 762 void KeySystemConfigSelector::OnPermissionResult( |
762 scoped_ptr<SelectionRequest> request, | 763 scoped_ptr<SelectionRequest> request, |
763 bool is_permission_granted) { | 764 bool is_permission_granted) { |
764 request->was_permission_requested = true; | 765 request->was_permission_requested = true; |
765 request->is_permission_granted = is_permission_granted; | 766 request->is_permission_granted = is_permission_granted; |
766 SelectConfigInternal(request.Pass()); | 767 SelectConfigInternal(request.Pass()); |
767 } | 768 } |
768 | 769 |
769 } // namespace media | 770 } // namespace media |
OLD | NEW |