| 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 "media/blink/key_system_config_selector.h" | 5 #include "media/blink/key_system_config_selector.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 DCHECK(media_permission_); | 292 DCHECK(media_permission_); |
| 293 } | 293 } |
| 294 | 294 |
| 295 KeySystemConfigSelector::~KeySystemConfigSelector() { | 295 KeySystemConfigSelector::~KeySystemConfigSelector() { |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool IsSupportedMediaFormat(const std::string& container_mime_type, | 298 bool IsSupportedMediaFormat(const std::string& container_mime_type, |
| 299 const std::string& codecs, | 299 const std::string& codecs, |
| 300 bool use_aes_decryptor) { | 300 bool use_aes_decryptor) { |
| 301 std::vector<std::string> codec_vector; | 301 std::vector<std::string> codec_vector; |
| 302 ParseCodecString(codecs, &codec_vector, false); | 302 SplitCodecsToVector(codecs, &codec_vector, false); |
| 303 // AesDecryptor decrypts the stream in the demuxer before it reaches the | 303 // AesDecryptor decrypts the stream in the demuxer before it reaches the |
| 304 // decoder so check whether the media format is supported when clear. | 304 // decoder so check whether the media format is supported when clear. |
| 305 SupportsType support_result = | 305 SupportsType support_result = |
| 306 use_aes_decryptor | 306 use_aes_decryptor |
| 307 ? IsSupportedMediaFormat(container_mime_type, codec_vector) | 307 ? IsSupportedMediaFormat(container_mime_type, codec_vector) |
| 308 : IsSupportedEncryptedMediaFormat(container_mime_type, codec_vector); | 308 : IsSupportedEncryptedMediaFormat(container_mime_type, codec_vector); |
| 309 return (support_result == IsSupported); | 309 return (support_result == IsSupported); |
| 310 } | 310 } |
| 311 | 311 |
| 312 // TODO(sandersd): Move contentType parsing from Blink to here so that invalid | 312 // TODO(sandersd): Move contentType parsing from Blink to here so that invalid |
| (...skipping 19 matching lines...) Expand all Loading... |
| 332 // robustness algorithm). | 332 // robustness algorithm). |
| 333 if (!IsSupportedMediaFormat(container_lower, codecs, | 333 if (!IsSupportedMediaFormat(container_lower, codecs, |
| 334 CanUseAesDecryptor(key_system))) { | 334 CanUseAesDecryptor(key_system))) { |
| 335 return false; | 335 return false; |
| 336 } | 336 } |
| 337 | 337 |
| 338 // Check that |container_mime_type| and |codecs| are supported by the CDM. | 338 // Check that |container_mime_type| and |codecs| are supported by the CDM. |
| 339 // This check does not handle extended codecs, so extended codec information | 339 // This check does not handle extended codecs, so extended codec information |
| 340 // is stripped (extended codec information was checked above). | 340 // is stripped (extended codec information was checked above). |
| 341 std::vector<std::string> stripped_codec_vector; | 341 std::vector<std::string> stripped_codec_vector; |
| 342 ParseCodecString(codecs, &stripped_codec_vector, true); | 342 SplitCodecsToVector(codecs, &stripped_codec_vector, true); |
| 343 EmeConfigRule codecs_rule = key_systems_->GetContentTypeConfigRule( | 343 EmeConfigRule codecs_rule = key_systems_->GetContentTypeConfigRule( |
| 344 key_system, media_type, container_lower, stripped_codec_vector); | 344 key_system, media_type, container_lower, stripped_codec_vector); |
| 345 if (!config_state->IsRuleSupported(codecs_rule)) | 345 if (!config_state->IsRuleSupported(codecs_rule)) |
| 346 return false; | 346 return false; |
| 347 config_state->AddRule(codecs_rule); | 347 config_state->AddRule(codecs_rule); |
| 348 | 348 |
| 349 return true; | 349 return true; |
| 350 } | 350 } |
| 351 | 351 |
| 352 bool KeySystemConfigSelector::GetSupportedCapabilities( | 352 bool KeySystemConfigSelector::GetSupportedCapabilities( |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 | 928 |
| 929 void KeySystemConfigSelector::OnPermissionResult( | 929 void KeySystemConfigSelector::OnPermissionResult( |
| 930 std::unique_ptr<SelectionRequest> request, | 930 std::unique_ptr<SelectionRequest> request, |
| 931 bool is_permission_granted) { | 931 bool is_permission_granted) { |
| 932 request->was_permission_requested = true; | 932 request->was_permission_requested = true; |
| 933 request->is_permission_granted = is_permission_granted; | 933 request->is_permission_granted = is_permission_granted; |
| 934 SelectConfigInternal(std::move(request)); | 934 SelectConfigInternal(std::move(request)); |
| 935 } | 935 } |
| 936 | 936 |
| 937 } // namespace media | 937 } // namespace media |
| OLD | NEW |