| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 DCHECK(!(response.compositing_codecs & ~media::EME_CODEC_ALL)) | 32 DCHECK(!(response.compositing_codecs & ~media::EME_CODEC_ALL)) |
| 33 << "unrecognized codec"; | 33 << "unrecognized codec"; |
| 34 DCHECK(!(response.non_compositing_codecs & ~media::EME_CODEC_ALL)) | 34 DCHECK(!(response.non_compositing_codecs & ~media::EME_CODEC_ALL)) |
| 35 << "unrecognized codec"; | 35 << "unrecognized codec"; |
| 36 return response; | 36 return response; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) { | 39 void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) { |
| 40 SupportedKeySystemResponse response = QueryKeySystemSupport( | 40 SupportedKeySystemResponse response = QueryKeySystemSupport( |
| 41 kWidevineKeySystem); | 41 kWidevineKeySystem); |
| 42 if (response.compositing_codecs != media::EME_CODEC_NONE) { | 42 |
| 43 // When creating the WIDEVINE key system, BrowserCdmFactoryAndroid configures |
| 44 // the CDM's security level based on the --mediadrm-enable-non-compositing |
| 45 // flag (L1 if the flag is enabled, L3 otherwise). Therefore the supported |
| 46 // codec/robustenss combinations depend on that flag. |
| 47 // TODO(sandersd): For unprefixed, set the security level based on the |
| 48 // requested robustness instead of the flag. http://crbug.com/467779 |
| 49 SupportedCodecs codecs = response.compositing_codecs; |
| 50 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 51 switches::kMediaDrmEnableNonCompositing)) { |
| 52 codecs = response.non_compositing_codecs; |
| 53 } |
| 54 if (codecs != media::EME_CODEC_NONE) { |
| 43 AddWidevineWithCodecs( | 55 AddWidevineWithCodecs( |
| 44 WIDEVINE, | 56 WIDEVINE, |
| 45 static_cast<SupportedCodecs>(response.compositing_codecs), | 57 codecs, |
| 46 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. | 58 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. |
| 47 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. | 59 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. |
| 48 media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. | 60 media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. |
| 49 media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier. | 61 media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier. |
| 50 concrete_key_systems); | 62 concrete_key_systems); |
| 51 } | 63 } |
| 52 | 64 |
| 65 // For compatibility with the prefixed API, register a separate L1 key system. |
| 66 // When creating the WIDEVINE_HR_NON_COMPOSITING key system, |
| 67 // BrowserCdmFactoryAndroid does not configure the CDM's security level (that |
| 68 // is, leaves it as L1); therefore only secure codecs are supported. |
| 69 // TODO(ddorwin): Remove with unprefixed. http://crbug.com/249976 |
| 53 if (response.non_compositing_codecs != media::EME_CODEC_NONE) { | 70 if (response.non_compositing_codecs != media::EME_CODEC_NONE) { |
| 54 // TODO(ddorwin): Remove with unprefixed. http://crbug.com/249976 | |
| 55 AddWidevineWithCodecs( | 71 AddWidevineWithCodecs( |
| 56 WIDEVINE_HR_NON_COMPOSITING, | 72 WIDEVINE_HR_NON_COMPOSITING, |
| 57 static_cast<SupportedCodecs>(response.non_compositing_codecs), | 73 response.non_compositing_codecs, |
| 58 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. | 74 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. |
| 59 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. | 75 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. |
| 60 media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. | 76 media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. |
| 61 media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier. | 77 media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier. |
| 62 concrete_key_systems); | 78 concrete_key_systems); |
| 63 } | 79 } |
| 64 } | 80 } |
| 65 | 81 |
| 66 void AddAndroidPlatformKeySystems( | 82 void AddAndroidPlatformKeySystems( |
| 67 std::vector<KeySystemInfo>* concrete_key_systems) { | 83 std::vector<KeySystemInfo>* concrete_key_systems) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 90 info.persistent_release_message_support = | 106 info.persistent_release_message_support = |
| 91 media::EME_SESSION_TYPE_NOT_SUPPORTED; | 107 media::EME_SESSION_TYPE_NOT_SUPPORTED; |
| 92 info.persistent_state_support = media::EME_FEATURE_ALWAYS_ENABLED; | 108 info.persistent_state_support = media::EME_FEATURE_ALWAYS_ENABLED; |
| 93 info.distinctive_identifier_support = media::EME_FEATURE_ALWAYS_ENABLED; | 109 info.distinctive_identifier_support = media::EME_FEATURE_ALWAYS_ENABLED; |
| 94 concrete_key_systems->push_back(info); | 110 concrete_key_systems->push_back(info); |
| 95 } | 111 } |
| 96 } | 112 } |
| 97 } | 113 } |
| 98 | 114 |
| 99 } // namespace cdm | 115 } // namespace cdm |
| OLD | NEW |