| OLD | NEW |
| 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/base/key_systems.h" | 5 #include "media/base/key_systems.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "media/base/key_system_info.h" | 17 #include "media/base/key_system_info.h" |
| 18 #include "media/base/media.h" |
| 18 #include "media/base/media_client.h" | 19 #include "media/base/media_client.h" |
| 19 #include "media/cdm/key_system_names.h" | 20 #include "media/cdm/key_system_names.h" |
| 20 #include "third_party/widevine/cdm/widevine_cdm_common.h" | 21 #include "third_party/widevine/cdm/widevine_cdm_common.h" |
| 21 | 22 |
| 22 namespace media { | 23 namespace media { |
| 23 | 24 |
| 24 const char kClearKeyKeySystem[] = "org.w3.clearkey"; | 25 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
| 25 | 26 |
| 26 // These names are used by UMA. Do not change them! | 27 // These names are used by UMA. Do not change them! |
| 27 const char kClearKeyKeySystemNameForUMA[] = "ClearKey"; | 28 const char kClearKeyKeySystemNameForUMA[] = "ClearKey"; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 #endif | 403 #endif |
| 403 if (!can_block) { | 404 if (!can_block) { |
| 404 DCHECK(info.distinctive_identifier_support == | 405 DCHECK(info.distinctive_identifier_support == |
| 405 EmeFeatureSupport::ALWAYS_ENABLED); | 406 EmeFeatureSupport::ALWAYS_ENABLED); |
| 406 DCHECK(info.persistent_state_support == | 407 DCHECK(info.persistent_state_support == |
| 407 EmeFeatureSupport::ALWAYS_ENABLED); | 408 EmeFeatureSupport::ALWAYS_ENABLED); |
| 408 } | 409 } |
| 409 | 410 |
| 410 DCHECK_EQ(key_system_map_.count(info.key_system), 0u) | 411 DCHECK_EQ(key_system_map_.count(info.key_system), 0u) |
| 411 << "Key system '" << info.key_system << "' already registered"; | 412 << "Key system '" << info.key_system << "' already registered"; |
| 413 |
| 414 #if defined(OS_ANDROID) |
| 415 // Ensure that the renderer can access the decoders necessary to use the |
| 416 // key system. |
| 417 if (!info.use_aes_decryptor && !ArePlatformDecodersAvailable()) { |
| 418 DLOG(WARNING) << info.key_system << " not registered"; |
| 419 continue; |
| 420 } |
| 421 #endif // defined(OS_ANDROID) |
| 422 |
| 412 key_system_map_[info.key_system] = info; | 423 key_system_map_[info.key_system] = info; |
| 413 } | 424 } |
| 414 } | 425 } |
| 415 | 426 |
| 416 // Adds the MIME type with the codec mask after verifying the validity. | 427 // Adds the MIME type with the codec mask after verifying the validity. |
| 417 // Only this function should modify |mime_type_to_codec_mask_map_|. | 428 // Only this function should modify |mime_type_to_codec_mask_map_|. |
| 418 void KeySystemsImpl::RegisterMimeType(const std::string& mime_type, | 429 void KeySystemsImpl::RegisterMimeType(const std::string& mime_type, |
| 419 EmeCodec codecs_mask) { | 430 EmeCodec codecs_mask) { |
| 420 DCHECK(thread_checker_.CalledOnValidThread()); | 431 DCHECK(thread_checker_.CalledOnValidThread()); |
| 421 DCHECK(!mime_type_to_codec_mask_map_.count(mime_type)); | 432 DCHECK(!mime_type_to_codec_mask_map_.count(mime_type)); |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 uint32_t mask) { | 785 uint32_t mask) { |
| 775 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); | 786 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); |
| 776 } | 787 } |
| 777 | 788 |
| 778 MEDIA_EXPORT void AddMimeTypeCodecMask(const std::string& mime_type, | 789 MEDIA_EXPORT void AddMimeTypeCodecMask(const std::string& mime_type, |
| 779 uint32_t mask) { | 790 uint32_t mask) { |
| 780 KeySystemsImpl::GetInstance()->AddMimeTypeCodecMask(mime_type, mask); | 791 KeySystemsImpl::GetInstance()->AddMimeTypeCodecMask(mime_type, mask); |
| 781 } | 792 } |
| 782 | 793 |
| 783 } // namespace media | 794 } // namespace media |
| OLD | NEW |