Chromium Code Reviews| 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 "components/cdm/renderer/widevine_key_systems.h" | 5 #include "components/cdm/renderer/widevine_key_systems.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 // Return |name|'s parent key system. | 22 // Return |name|'s parent key system. |
| 23 static std::string GetDirectParentName(std::string name) { | 23 static std::string GetDirectParentName(std::string name) { |
| 24 size_t last_period = name.find_last_of('.'); | 24 size_t last_period = name.find_last_of('.'); |
| 25 DCHECK_GT(last_period, 0u); | 25 DCHECK_GT(last_period, 0u); |
| 26 return name.substr(0u, last_period); | 26 return name.substr(0u, last_period); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void AddWidevineWithCodecs( | 29 void AddWidevineWithCodecs( |
| 30 WidevineCdmType widevine_cdm_type, | 30 WidevineCdmType widevine_cdm_type, |
| 31 SupportedCodecs supported_codecs, | 31 SupportedCodecs supported_codecs, |
| 32 #if defined(OS_ANDROID) | |
| 33 SupportedCodecs supported_secure_codecs, | |
| 34 #endif // defined(OS_ANDROID) | |
| 32 media::EmeRobustness max_audio_robustness, | 35 media::EmeRobustness max_audio_robustness, |
| 33 media::EmeRobustness max_video_robustness, | 36 media::EmeRobustness max_video_robustness, |
| 34 media::EmeSessionTypeSupport persistent_license_support, | 37 media::EmeSessionTypeSupport persistent_license_support, |
| 35 media::EmeSessionTypeSupport persistent_release_message_support, | 38 media::EmeSessionTypeSupport persistent_release_message_support, |
| 36 media::EmeFeatureSupport persistent_state_support, | 39 media::EmeFeatureSupport persistent_state_support, |
| 37 media::EmeFeatureSupport distinctive_identifier_support, | 40 media::EmeFeatureSupport distinctive_identifier_support, |
| 38 std::vector<KeySystemInfo>* concrete_key_systems) { | 41 std::vector<KeySystemInfo>* concrete_key_systems) { |
| 39 KeySystemInfo info; | 42 KeySystemInfo info; |
| 40 info.key_system = kWidevineKeySystem; | 43 info.key_system = kWidevineKeySystem; |
| 41 | 44 |
| 42 switch (widevine_cdm_type) { | 45 switch (widevine_cdm_type) { |
| 43 case WIDEVINE: | 46 case WIDEVINE: |
| 44 // For standard Widevine, add parent name. | 47 // For standard Widevine, add parent name. |
| 45 info.parent_key_system = GetDirectParentName(kWidevineKeySystem); | 48 info.parent_key_system = GetDirectParentName(kWidevineKeySystem); |
| 46 break; | 49 break; |
| 47 #if defined(OS_ANDROID) | 50 #if defined(OS_ANDROID) |
| 48 case WIDEVINE_HR_NON_COMPOSITING: | 51 case WIDEVINE_HR_NON_COMPOSITING: |
| 49 info.key_system.append(".hrnoncompositing"); | 52 info.key_system.append(".hrnoncompositing"); |
| 50 break; | 53 break; |
| 51 #endif // defined(OS_ANDROID) | 54 #endif // defined(OS_ANDROID) |
| 52 default: | 55 default: |
| 53 NOTREACHED(); | 56 NOTREACHED(); |
| 54 } | 57 } |
| 55 | 58 |
| 56 // TODO(xhwang): A container or an initDataType may be supported even though | 59 // TODO(xhwang): A container or an initDataType may be supported even though |
| 57 // there are no codecs supported in that container. Fix this when we support | 60 // there are no codecs supported in that container. Fix this when we support |
| 58 // initDataType. | 61 // initDataType. |
| 59 info.supported_codecs = supported_codecs; | 62 info.supported_codecs = supported_codecs; |
| 63 #if defined(OS_ANDROID) | |
| 64 info.supported_secure_codecs = supported_secure_codecs; | |
|
jrummell
2015/04/30 02:08:37
Do we need a DCHECK that |supported_secure_codecs|
sandersd (OOO until July 31)
2015/04/30 18:19:34
I had that, but in the end moved the subset logic
| |
| 65 #endif // defined(OS_ANDROID) | |
| 60 | 66 |
| 61 // Here we assume that support for a container imples support for the | 67 // Here we assume that support for a container imples support for the |
| 62 // associated initialization data type. KeySystems handles validating | 68 // associated initialization data type. KeySystems handles validating |
| 63 // |init_data_type| x |container| pairings. | 69 // |init_data_type| x |container| pairings. |
| 64 if (supported_codecs & media::EME_CODEC_WEBM_ALL) | 70 if (supported_codecs & media::EME_CODEC_WEBM_ALL) |
| 65 info.supported_init_data_types |= media::kInitDataTypeMaskWebM; | 71 info.supported_init_data_types |= media::kInitDataTypeMaskWebM; |
| 66 #if defined(USE_PROPRIETARY_CODECS) | 72 #if defined(USE_PROPRIETARY_CODECS) |
| 67 if (supported_codecs & media::EME_CODEC_MP4_ALL) | 73 if (supported_codecs & media::EME_CODEC_MP4_ALL) |
| 68 info.supported_init_data_types |= media::kInitDataTypeMaskCenc; | 74 info.supported_init_data_types |= media::kInitDataTypeMaskCenc; |
| 69 #endif // defined(USE_PROPRIETARY_CODECS) | 75 #endif // defined(USE_PROPRIETARY_CODECS) |
| 70 | 76 |
| 71 info.max_audio_robustness = max_audio_robustness; | 77 info.max_audio_robustness = max_audio_robustness; |
| 72 info.max_video_robustness = max_video_robustness; | 78 info.max_video_robustness = max_video_robustness; |
| 73 info.persistent_license_support = persistent_license_support; | 79 info.persistent_license_support = persistent_license_support; |
| 74 info.persistent_release_message_support = persistent_release_message_support; | 80 info.persistent_release_message_support = persistent_release_message_support; |
| 75 info.persistent_state_support = persistent_state_support; | 81 info.persistent_state_support = persistent_state_support; |
| 76 info.distinctive_identifier_support = distinctive_identifier_support; | 82 info.distinctive_identifier_support = distinctive_identifier_support; |
| 77 | 83 |
| 78 #if defined(ENABLE_PEPPER_CDMS) | 84 #if defined(ENABLE_PEPPER_CDMS) |
| 79 info.pepper_type = kWidevineCdmPluginMimeType; | 85 info.pepper_type = kWidevineCdmPluginMimeType; |
| 80 #endif // defined(ENABLE_PEPPER_CDMS) | 86 #endif // defined(ENABLE_PEPPER_CDMS) |
| 81 | 87 |
| 82 concrete_key_systems->push_back(info); | 88 concrete_key_systems->push_back(info); |
| 83 } | 89 } |
| 84 | 90 |
| 85 } // namespace cdm | 91 } // namespace cdm |
| 86 | 92 |
| 87 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 93 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| OLD | NEW |