Chromium Code Reviews| Index: media/base/key_systems.cc |
| diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc |
| index 92bcc38e880877486041d13bbb06c98110eff08d..3ce91d09ea5961eb65d276015178b768f9b5ce21 100644 |
| --- a/media/base/key_systems.cc |
| +++ b/media/base/key_systems.cc |
| @@ -34,14 +34,11 @@ struct NamedInitDataType { |
| EmeInitDataType type; |
| }; |
| -// Mapping between initialization data types names and enum values. When adding |
| -// entries, make sure to update IsSaneInitDataTypeWithContainer(). |
| +// Mapping between initialization data types names and enum values. |
| static NamedInitDataType kInitDataTypeNames[] = { |
| - {"webm", EME_INIT_DATA_TYPE_WEBM}, |
| -#if defined(USE_PROPRIETARY_CODECS) |
| - {"cenc", EME_INIT_DATA_TYPE_CENC}, |
| -#endif // defined(USE_PROPRIETARY_CODECS) |
| - {"keyids", EME_INIT_DATA_TYPE_KEYIDS}, |
| + {"webm", EmeInitDataType::WEBM}, |
| + {"cenc", EmeInitDataType::CENC}, |
| + {"keyids", EmeInitDataType::KEYIDS}, |
| }; |
| struct NamedCodec { |
| @@ -85,7 +82,7 @@ static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { |
| // VP9 support is device dependent. |
| info.supported_init_data_types = |
| - EME_INIT_DATA_TYPE_WEBM | EME_INIT_DATA_TYPE_KEYIDS; |
| + kSupportedInitDataTypeWebM | kSupportedInitDataTypeKeyIds; |
| info.supported_codecs = EME_CODEC_WEBM_ALL; |
| #if defined(OS_ANDROID) |
| @@ -99,7 +96,7 @@ static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { |
| #endif // defined(OS_ANDROID) |
| #if defined(USE_PROPRIETARY_CODECS) |
| - info.supported_init_data_types |= EME_INIT_DATA_TYPE_CENC; |
| + info.supported_init_data_types |= kSupportedInitDataTypeCenc; |
| info.supported_codecs |= EME_CODEC_MP4_ALL; |
| #endif // defined(USE_PROPRIETARY_CODECS) |
| @@ -315,7 +312,7 @@ EmeInitDataType KeySystems::GetInitDataTypeForName( |
| init_data_type_name_map_.find(init_data_type); |
| if (iter != init_data_type_name_map_.end()) |
| return iter->second; |
| - return EME_INIT_DATA_TYPE_NONE; |
| + return EmeInitDataType::NONE; |
|
sandersd (OOO until July 31)
2015/03/23 21:27:30
This method is only used from one place, and it's
jrummell
2015/03/25 21:44:25
In the future calls to IsSupportedKeySystemWithIni
|
| } |
| SupportedCodecs KeySystems::GetCodecMaskForContainer( |
| @@ -519,10 +516,21 @@ bool KeySystems::IsSupportedKeySystemWithInitDataType( |
| if (key_system_iter == concrete_key_system_map_.end()) |
| return false; |
| - // Check |init_data_type| and |key_system| x |init_data_type|. |
| - const KeySystemInfo& info = key_system_iter->second; |
| - EmeInitDataType eme_init_data_type = GetInitDataTypeForName(init_data_type); |
| - return (info.supported_init_data_types & eme_init_data_type) != 0; |
| + // Check |init_data_type|. |
| + SupportedInitDataTypes available_init_data_types = |
| + key_system_iter->second.supported_init_data_types; |
| + switch (GetInitDataTypeForName(init_data_type)) { |
| + case EmeInitDataType::NONE: |
| + return false; |
| + case EmeInitDataType::WEBM: |
| + return (available_init_data_types & kSupportedInitDataTypeWebM) != 0; |
| + case EmeInitDataType::CENC: |
| + return (available_init_data_types & kSupportedInitDataTypeCenc) != 0; |
| + case EmeInitDataType::KEYIDS: |
| + return (available_init_data_types & kSupportedInitDataTypeKeyIds) != 0; |
| + } |
| + NOTREACHED(); |
| + return false; |
| } |
| // TODO(sandersd): Reorganize to be more similar to |
| @@ -781,18 +789,6 @@ std::string GetPrefixedKeySystemName(const std::string& key_system) { |
| return key_system; |
| } |
| -bool IsSaneInitDataTypeWithContainer( |
| - const std::string& init_data_type, |
| - const std::string& container) { |
| - if (init_data_type == "cenc") { |
| - return container == "audio/mp4" || container == "video/mp4"; |
| - } else if (init_data_type == "webm") { |
| - return container == "audio/webm" || container == "video/webm"; |
| - } else { |
| - return true; |
| - } |
| -} |
| - |
| bool PrefixedIsSupportedConcreteKeySystem(const std::string& key_system) { |
| return KeySystems::GetInstance().IsConcreteSupportedKeySystem(key_system); |
| } |