| 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/android_key_systems.h" | 5 #include "components/cdm/renderer/android_key_systems.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) { | 44 void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) { |
| 45 SupportedKeySystemResponse response = QueryKeySystemSupport( | 45 SupportedKeySystemResponse response = QueryKeySystemSupport( |
| 46 kWidevineKeySystem); | 46 kWidevineKeySystem); |
| 47 | 47 |
| 48 // Since we do not control the implementation of the MediaDrm API on Android, | 48 // Since we do not control the implementation of the MediaDrm API on Android, |
| 49 // we assume that it can and will make use of persistence even though no | 49 // we assume that it can and will make use of persistence even though no |
| 50 // persistence-based features are supported. | 50 // persistence-based features are supported. |
| 51 | 51 |
| 52 if (response.compositing_codecs != media::EME_CODEC_NONE) { | 52 if (response.compositing_codecs != media::EME_CODEC_NONE) { |
| 53 AddWidevineWithCodecs( | 53 AddWidevineWithCodecs( |
| 54 WIDEVINE, | |
| 55 response.compositing_codecs, // Regular codecs. | 54 response.compositing_codecs, // Regular codecs. |
| 56 response.non_compositing_codecs, // Hardware-secure codecs. | 55 response.non_compositing_codecs, // Hardware-secure codecs. |
| 57 EmeRobustness::HW_SECURE_CRYPTO, // Max audio robustness. | 56 EmeRobustness::HW_SECURE_CRYPTO, // Max audio robustness. |
| 58 EmeRobustness::HW_SECURE_ALL, // Max video robustness. | 57 EmeRobustness::HW_SECURE_ALL, // Max video robustness. |
| 59 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. | 58 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. |
| 60 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message. | 59 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message. |
| 61 EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state. | 60 EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state. |
| 62 EmeFeatureSupport::ALWAYS_ENABLED, // Distinctive identifier. | 61 EmeFeatureSupport::ALWAYS_ENABLED, // Distinctive identifier. |
| 63 concrete_key_systems); | 62 concrete_key_systems); |
| 64 } else { | 63 } else { |
| 65 // It doesn't make sense to support secure codecs but not regular codecs. | 64 // It doesn't make sense to support secure codecs but not regular codecs. |
| 66 DCHECK(response.non_compositing_codecs == media::EME_CODEC_NONE); | 65 DCHECK(response.non_compositing_codecs == media::EME_CODEC_NONE); |
| 67 } | 66 } |
| 68 | |
| 69 // For compatibility with the prefixed API, register a separate L1 key system. | |
| 70 // This key systems acts as though only hardware-secure codecs are available. | |
| 71 // We only register support for codecs with both regular and hardware-secure | |
| 72 // variants so that we can be sure they will work regardless of the renderer | |
| 73 // preference. | |
| 74 SupportedCodecs secure_codecs = | |
| 75 response.compositing_codecs & response.non_compositing_codecs; | |
| 76 if (secure_codecs != media::EME_CODEC_NONE) { | |
| 77 // Note: The prefixed API only consults the regular codecs field. | |
| 78 AddWidevineWithCodecs( | |
| 79 WIDEVINE_HR_NON_COMPOSITING, | |
| 80 secure_codecs, // Regular codecs. | |
| 81 media::EME_CODEC_NONE, // Hardware-secure codecs. | |
| 82 EmeRobustness::HW_SECURE_CRYPTO, // Max audio robustness. | |
| 83 EmeRobustness::HW_SECURE_ALL, // Max video robustness. | |
| 84 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. | |
| 85 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message. | |
| 86 EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state. | |
| 87 EmeFeatureSupport::ALWAYS_ENABLED, // Distinctive identifier. | |
| 88 concrete_key_systems); | |
| 89 } | |
| 90 } | 67 } |
| 91 | 68 |
| 92 void AddAndroidPlatformKeySystems( | 69 void AddAndroidPlatformKeySystems( |
| 93 std::vector<KeySystemInfo>* concrete_key_systems) { | 70 std::vector<KeySystemInfo>* concrete_key_systems) { |
| 94 std::vector<std::string> key_system_names; | 71 std::vector<std::string> key_system_names; |
| 95 content::RenderThread::Get()->Send( | 72 content::RenderThread::Get()->Send( |
| 96 new ChromeViewHostMsg_GetPlatformKeySystemNames(&key_system_names)); | 73 new ChromeViewHostMsg_GetPlatformKeySystemNames(&key_system_names)); |
| 97 | 74 |
| 98 for (std::vector<std::string>::const_iterator it = key_system_names.begin(); | 75 for (std::vector<std::string>::const_iterator it = key_system_names.begin(); |
| 99 it != key_system_names.end(); ++it) { | 76 it != key_system_names.end(); ++it) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 121 media::EmeSessionTypeSupport::NOT_SUPPORTED; | 98 media::EmeSessionTypeSupport::NOT_SUPPORTED; |
| 122 info.persistent_state_support = media::EmeFeatureSupport::ALWAYS_ENABLED; | 99 info.persistent_state_support = media::EmeFeatureSupport::ALWAYS_ENABLED; |
| 123 info.distinctive_identifier_support = | 100 info.distinctive_identifier_support = |
| 124 media::EmeFeatureSupport::ALWAYS_ENABLED; | 101 media::EmeFeatureSupport::ALWAYS_ENABLED; |
| 125 concrete_key_systems->push_back(info); | 102 concrete_key_systems->push_back(info); |
| 126 } | 103 } |
| 127 } | 104 } |
| 128 } | 105 } |
| 129 | 106 |
| 130 } // namespace cdm | 107 } // namespace cdm |
| OLD | NEW |