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 "chromecast/renderer/key_systems_cast.h" | 5 #include "chromecast/renderer/key_systems_cast.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 using ::media::EmeSessionTypeSupport; | 23 using ::media::EmeSessionTypeSupport; |
24 using ::media::SupportedCodecs; | 24 using ::media::SupportedCodecs; |
25 | 25 |
26 namespace chromecast { | 26 namespace chromecast { |
27 namespace shell { | 27 namespace shell { |
28 namespace { | 28 namespace { |
29 | 29 |
30 #if defined(PLAYREADY_CDM_AVAILABLE) | 30 #if defined(PLAYREADY_CDM_AVAILABLE) |
31 class PlayReadyKeySystemProperties : public ::media::KeySystemProperties { | 31 class PlayReadyKeySystemProperties : public ::media::KeySystemProperties { |
32 public: | 32 public: |
33 explicit PlayReadyKeySystemProperties(bool persistent_license_support) | |
34 : persistent_license_support_(persistent_license_support) { | |
35 } | |
36 | |
33 std::string GetKeySystemName() const override { | 37 std::string GetKeySystemName() const override { |
34 return media::kChromecastPlayreadyKeySystem; | 38 return media::kChromecastPlayreadyKeySystem; |
35 } | 39 } |
36 | 40 |
37 bool IsSupportedInitDataType(EmeInitDataType init_data_type) const override { | 41 bool IsSupportedInitDataType(EmeInitDataType init_data_type) const override { |
38 return init_data_type == EmeInitDataType::CENC; | 42 return init_data_type == EmeInitDataType::CENC; |
39 } | 43 } |
40 | 44 |
41 SupportedCodecs GetSupportedCodecs() const override { | 45 SupportedCodecs GetSupportedCodecs() const override { |
42 return ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1; | 46 return ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1; |
43 } | 47 } |
44 | 48 |
45 EmeConfigRule GetRobustnessConfigRule( | 49 EmeConfigRule GetRobustnessConfigRule( |
46 EmeMediaType media_type, | 50 EmeMediaType media_type, |
47 const std::string& requested_robustness) const override { | 51 const std::string& requested_robustness) const override { |
48 return requested_robustness.empty() ? EmeConfigRule::SUPPORTED | 52 return requested_robustness.empty() ? EmeConfigRule::SUPPORTED |
49 : EmeConfigRule::NOT_SUPPORTED; | 53 : EmeConfigRule::NOT_SUPPORTED; |
50 } | 54 } |
51 | 55 |
52 EmeSessionTypeSupport GetPersistentLicenseSessionSupport() const override { | 56 EmeSessionTypeSupport GetPersistentLicenseSessionSupport() const override { |
53 #if defined(OS_ANDROID) | 57 #if defined(OS_ANDROID) |
54 return EmeSessionTypeSupport::NOT_SUPPORTED; | 58 return EmeSessionTypeSupport::NOT_SUPPORTED; |
55 #else | 59 #else |
56 return EmeSessionTypeSupport::SUPPORTED; | 60 return persistent_license_support_ ? EmeSessionTypeSupport::SUPPORTED |
61 : EmeSessionType::NOT_SUPPORTED; | |
57 #endif | 62 #endif |
58 } | 63 } |
59 | 64 |
60 EmeSessionTypeSupport GetPersistentReleaseMessageSessionSupport() | 65 EmeSessionTypeSupport GetPersistentReleaseMessageSessionSupport() |
61 const override { | 66 const override { |
62 return EmeSessionTypeSupport::NOT_SUPPORTED; | 67 return EmeSessionTypeSupport::NOT_SUPPORTED; |
63 } | 68 } |
64 | 69 |
65 EmeFeatureSupport GetPersistentStateSupport() const override { | 70 EmeFeatureSupport GetPersistentStateSupport() const override { |
66 return EmeFeatureSupport::ALWAYS_ENABLED; | 71 return EmeFeatureSupport::ALWAYS_ENABLED; |
67 } | 72 } |
68 EmeFeatureSupport GetDistinctiveIdentifierSupport() const override { | 73 EmeFeatureSupport GetDistinctiveIdentifierSupport() const override { |
69 return EmeFeatureSupport::ALWAYS_ENABLED; | 74 return EmeFeatureSupport::ALWAYS_ENABLED; |
70 } | 75 } |
76 | |
77 private: | |
78 const bool persistent_license_support_; | |
71 }; | 79 }; |
72 #endif // PLAYREADY_CDM_AVAILABLE | 80 #endif // PLAYREADY_CDM_AVAILABLE |
73 | 81 |
74 } // namespace | 82 } // namespace |
75 | 83 |
76 void AddChromecastKeySystems( | 84 void AddChromecastKeySystems( |
77 std::vector<std::unique_ptr<::media::KeySystemProperties>>* | 85 std::vector<std::unique_ptr<::media::KeySystemProperties>>* |
78 key_systems_properties) { | 86 key_systems_properties, |
87 bool enable_persistent_license_support) { | |
yucliu1
2016/06/02 16:31:52
Is the flag only for playready?
| |
79 #if defined(PLAYREADY_CDM_AVAILABLE) | 88 #if defined(PLAYREADY_CDM_AVAILABLE) |
80 key_systems_properties->emplace_back(new PlayReadyKeySystemProperties()); | 89 key_systems_properties->emplace_back( |
90 new PlayReadyKeySystemProperties(enable_persistent_license_support)); | |
81 #endif // defined(PLAYREADY_CDM_AVAILABLE) | 91 #endif // defined(PLAYREADY_CDM_AVAILABLE) |
82 | 92 |
83 #if defined(WIDEVINE_CDM_AVAILABLE) | 93 #if defined(WIDEVINE_CDM_AVAILABLE) |
84 using Robustness = cdm::WidevineKeySystemProperties::Robustness; | 94 using Robustness = cdm::WidevineKeySystemProperties::Robustness; |
85 ::media::SupportedCodecs codecs = | 95 ::media::SupportedCodecs codecs = |
86 ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1 | | 96 ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1 | |
87 ::media::EME_CODEC_WEBM_VP8 | ::media::EME_CODEC_WEBM_VP9; | 97 ::media::EME_CODEC_WEBM_VP8 | ::media::EME_CODEC_WEBM_VP9; |
88 key_systems_properties->emplace_back(new cdm::WidevineKeySystemProperties( | 98 key_systems_properties->emplace_back(new cdm::WidevineKeySystemProperties( |
89 codecs, // Regular codecs. | 99 codecs, // Regular codecs. |
90 #if defined(OS_ANDROID) | 100 #if defined(OS_ANDROID) |
91 codecs, // Hardware-secure codecs. | 101 codecs, // Hardware-secure codecs. |
92 #endif | 102 #endif |
93 Robustness::HW_SECURE_ALL, // Max audio robustness. | 103 Robustness::HW_SECURE_ALL, // Max audio robustness. |
94 Robustness::HW_SECURE_ALL, // Max video robustness. | 104 Robustness::HW_SECURE_ALL, // Max video robustness. |
95 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. | 105 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. |
96 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message. | 106 EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message. |
97 // Note: On Chromecast, all CDMs may have persistent state. | 107 // Note: On Chromecast, all CDMs may have persistent state. |
98 EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state. | 108 EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state. |
99 EmeFeatureSupport::ALWAYS_ENABLED)); // Distinctive identifier. | 109 EmeFeatureSupport::ALWAYS_ENABLED)); // Distinctive identifier. |
100 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 110 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
101 } | 111 } |
102 | 112 |
103 } // namespace shell | 113 } // namespace shell |
104 } // namespace chromecast | 114 } // namespace chromecast |
OLD | NEW |