| 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 25 matching lines...) Expand all Loading... |
| 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 if (response.compositing_codecs != media::EME_CODEC_NONE) { |
| 43 AddWidevineWithCodecs( | 43 AddWidevineWithCodecs( |
| 44 WIDEVINE, | 44 WIDEVINE, |
| 45 static_cast<SupportedCodecs>(response.compositing_codecs), | 45 static_cast<SupportedCodecs>(response.compositing_codecs), |
| 46 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. |
| 47 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. |
| 48 media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. |
| 49 media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier. |
| 46 concrete_key_systems); | 50 concrete_key_systems); |
| 47 } | 51 } |
| 48 | 52 |
| 49 if (response.non_compositing_codecs != media::EME_CODEC_NONE) { | 53 if (response.non_compositing_codecs != media::EME_CODEC_NONE) { |
| 54 // TODO(ddorwin): Remove with unprefixed. http://crbug.com/249976 |
| 50 AddWidevineWithCodecs( | 55 AddWidevineWithCodecs( |
| 51 WIDEVINE_HR_NON_COMPOSITING, | 56 WIDEVINE_HR_NON_COMPOSITING, |
| 52 static_cast<SupportedCodecs>(response.non_compositing_codecs), | 57 static_cast<SupportedCodecs>(response.non_compositing_codecs), |
| 58 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. |
| 59 media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. |
| 60 media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. |
| 61 media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier. |
| 53 concrete_key_systems); | 62 concrete_key_systems); |
| 54 } | 63 } |
| 55 } | 64 } |
| 56 | 65 |
| 57 void AddAndroidPlatformKeySystems( | 66 void AddAndroidPlatformKeySystems( |
| 58 std::vector<KeySystemInfo>* concrete_key_systems) { | 67 std::vector<KeySystemInfo>* concrete_key_systems) { |
| 59 std::vector<std::string> key_system_names; | 68 std::vector<std::string> key_system_names; |
| 60 content::RenderThread::Get()->Send( | 69 content::RenderThread::Get()->Send( |
| 61 new ChromeViewHostMsg_GetPlatformKeySystemNames(&key_system_names)); | 70 new ChromeViewHostMsg_GetPlatformKeySystemNames(&key_system_names)); |
| 62 | 71 |
| 63 for (std::vector<std::string>::const_iterator it = key_system_names.begin(); | 72 for (std::vector<std::string>::const_iterator it = key_system_names.begin(); |
| 64 it != key_system_names.end(); ++it) { | 73 it != key_system_names.end(); ++it) { |
| 65 SupportedKeySystemResponse response = QueryKeySystemSupport(*it); | 74 SupportedKeySystemResponse response = QueryKeySystemSupport(*it); |
| 66 if (response.compositing_codecs != media::EME_CODEC_NONE) { | 75 if (response.compositing_codecs != media::EME_CODEC_NONE) { |
| 67 KeySystemInfo info(*it); | 76 KeySystemInfo info; |
| 77 info.key_system = *it; |
| 68 info.supported_codecs = response.compositing_codecs; | 78 info.supported_codecs = response.compositing_codecs; |
| 69 // Here we assume that support for a container implies support for the | 79 // Here we assume that support for a container implies support for the |
| 70 // associated initialization data type. KeySystems handles validating | 80 // associated initialization data type. KeySystems handles validating |
| 71 // |init_data_type| x |container| pairings. | 81 // |init_data_type| x |container| pairings. |
| 72 if (response.compositing_codecs & media::EME_CODEC_WEBM_ALL) | 82 if (response.compositing_codecs & media::EME_CODEC_WEBM_ALL) |
| 73 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_WEBM; | 83 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_WEBM; |
| 74 #if defined(USE_PROPRIETARY_CODECS) | 84 #if defined(USE_PROPRIETARY_CODECS) |
| 75 if (response.compositing_codecs & media::EME_CODEC_MP4_ALL) | 85 if (response.compositing_codecs & media::EME_CODEC_MP4_ALL) |
| 76 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC; | 86 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC; |
| 77 #endif // defined(USE_PROPRIETARY_CODECS) | 87 #endif // defined(USE_PROPRIETARY_CODECS) |
| 88 // Assume the worst case (from a user point of view). |
| 89 info.persistent_license_support = media::EME_SESSION_TYPE_NOT_SUPPORTED; |
| 90 info.persistent_release_message_support = |
| 91 media::EME_SESSION_TYPE_NOT_SUPPORTED; |
| 92 info.persistent_state_support = media::EME_FEATURE_ALWAYS_ENABLED; |
| 93 info.distinctive_identifier_support = media::EME_FEATURE_ALWAYS_ENABLED; |
| 78 concrete_key_systems->push_back(info); | 94 concrete_key_systems->push_back(info); |
| 79 } | 95 } |
| 80 } | 96 } |
| 81 } | 97 } |
| 82 | 98 |
| 83 } // namespace cdm | 99 } // namespace cdm |
| OLD | NEW |