| 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/media/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" | 
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" | 
| 12 #include "chromecast/media/base/key_systems_common.h" | 12 #include "chromecast/media/base/key_systems_common.h" | 
| 13 #include "components/cdm/renderer/android_key_systems.h" | 13 #include "components/cdm/renderer/android_key_systems.h" | 
| 14 #include "components/cdm/renderer/widevine_key_system_properties.h" | 14 #include "components/cdm/renderer/widevine_key_system_properties.h" | 
| 15 #include "media/base/eme_constants.h" | 15 #include "media/base/eme_constants.h" | 
| 16 #include "media/base/key_system_properties.h" | 16 #include "media/base/key_system_properties.h" | 
| 17 #include "media/media_features.h" | 17 #include "media/media_features.h" | 
| 18 | 18 | 
| 19 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 19 #include "widevine_cdm_version.h"  // In SHARED_INTERMEDIATE_DIR. | 
| 20 | 20 | 
| 21 using ::media::EmeConfigRule; | 21 using ::media::EmeConfigRule; | 
| 22 using ::media::EmeFeatureSupport; | 22 using ::media::EmeFeatureSupport; | 
| 23 using ::media::EmeInitDataType; | 23 using ::media::EmeInitDataType; | 
| 24 using ::media::EmeMediaType; | 24 using ::media::EmeMediaType; | 
| 25 using ::media::EmeSessionTypeSupport; | 25 using ::media::EmeSessionTypeSupport; | 
| 26 using ::media::SupportedCodecs; | 26 using ::media::SupportedCodecs; | 
| 27 | 27 | 
| 28 namespace chromecast { | 28 namespace chromecast { | 
| 29 namespace shell { | 29 namespace media { | 
| 30 namespace { | 30 namespace { | 
| 31 | 31 | 
| 32 #if defined(PLAYREADY_CDM_AVAILABLE) | 32 #if defined(PLAYREADY_CDM_AVAILABLE) | 
| 33 class PlayReadyKeySystemProperties : public ::media::KeySystemProperties { | 33 class PlayReadyKeySystemProperties : public ::media::KeySystemProperties { | 
| 34  public: | 34  public: | 
| 35   explicit PlayReadyKeySystemProperties(bool persistent_license_support) | 35   explicit PlayReadyKeySystemProperties(bool persistent_license_support) | 
| 36       : persistent_license_support_(persistent_license_support) { | 36       : persistent_license_support_(persistent_license_support) {} | 
| 37   } |  | 
| 38 | 37 | 
| 39   std::string GetKeySystemName() const override { | 38   std::string GetKeySystemName() const override { | 
| 40     return media::kChromecastPlayreadyKeySystem; | 39     return media::kChromecastPlayreadyKeySystem; | 
| 41   } | 40   } | 
| 42 | 41 | 
| 43   bool IsSupportedInitDataType(EmeInitDataType init_data_type) const override { | 42   bool IsSupportedInitDataType(EmeInitDataType init_data_type) const override { | 
| 44     return init_data_type == EmeInitDataType::CENC; | 43     return init_data_type == EmeInitDataType::CENC; | 
| 45   } | 44   } | 
| 46 | 45 | 
| 47   SupportedCodecs GetSupportedCodecs() const override { | 46   SupportedCodecs GetSupportedCodecs() const override { | 
| 48     SupportedCodecs codecs = | 47     SupportedCodecs codecs = | 
| 49         ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1; | 48         ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1; | 
| 50 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | 49 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | 
| 51     codecs |= ::media::EME_CODEC_MP4_HEVC; | 50     codecs |= ::media::EME_CODEC_MP4_HEVC; | 
| 52 #endif | 51 #endif | 
| 53     return codecs; | 52     return codecs; | 
| 54   } | 53   } | 
| 55 | 54 | 
| 56   EmeConfigRule GetRobustnessConfigRule( | 55   EmeConfigRule GetRobustnessConfigRule( | 
| 57       EmeMediaType media_type, | 56       EmeMediaType media_type, | 
| 58       const std::string& requested_robustness) const override { | 57       const std::string& requested_robustness) const override { | 
| 59     return requested_robustness.empty() ? EmeConfigRule::SUPPORTED | 58     return requested_robustness.empty() ? EmeConfigRule::SUPPORTED | 
| 60                                         : EmeConfigRule::NOT_SUPPORTED; | 59                                         : EmeConfigRule::NOT_SUPPORTED; | 
| 61   } | 60   } | 
| 62 | 61 | 
| 63   EmeSessionTypeSupport GetPersistentLicenseSessionSupport() const override { | 62   EmeSessionTypeSupport GetPersistentLicenseSessionSupport() const override { | 
| 64     return persistent_license_support_ ? EmeSessionTypeSupport::SUPPORTED | 63     return persistent_license_support_ ? EmeSessionTypeSupport::SUPPORTED | 
| 65         : EmeSessionTypeSupport::NOT_SUPPORTED; | 64                                        : EmeSessionTypeSupport::NOT_SUPPORTED; | 
| 66   } | 65   } | 
| 67 | 66 | 
| 68   EmeSessionTypeSupport GetPersistentReleaseMessageSessionSupport() | 67   EmeSessionTypeSupport GetPersistentReleaseMessageSessionSupport() | 
| 69       const override { | 68       const override { | 
| 70     return EmeSessionTypeSupport::NOT_SUPPORTED; | 69     return EmeSessionTypeSupport::NOT_SUPPORTED; | 
| 71   } | 70   } | 
| 72 | 71 | 
| 73   EmeFeatureSupport GetPersistentStateSupport() const override { | 72   EmeFeatureSupport GetPersistentStateSupport() const override { | 
| 74     return EmeFeatureSupport::ALWAYS_ENABLED; | 73     return EmeFeatureSupport::ALWAYS_ENABLED; | 
| 75   } | 74   } | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 106 #else | 105 #else | 
| 107   using Robustness = cdm::WidevineKeySystemProperties::Robustness; | 106   using Robustness = cdm::WidevineKeySystemProperties::Robustness; | 
| 108   ::media::SupportedCodecs codecs = | 107   ::media::SupportedCodecs codecs = | 
| 109       ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1 | | 108       ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1 | | 
| 110       ::media::EME_CODEC_MP4_VP9 | ::media::EME_CODEC_WEBM_VP8 | | 109       ::media::EME_CODEC_MP4_VP9 | ::media::EME_CODEC_WEBM_VP8 | | 
| 111       ::media::EME_CODEC_WEBM_VP9; | 110       ::media::EME_CODEC_WEBM_VP9; | 
| 112 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | 111 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | 
| 113   codecs |= ::media::EME_CODEC_MP4_HEVC; | 112   codecs |= ::media::EME_CODEC_MP4_HEVC; | 
| 114 #endif | 113 #endif | 
| 115   key_systems_properties->emplace_back(new cdm::WidevineKeySystemProperties( | 114   key_systems_properties->emplace_back(new cdm::WidevineKeySystemProperties( | 
| 116       codecs,  // Regular codecs. | 115       codecs,                     // Regular codecs. | 
| 117       Robustness::HW_SECURE_ALL,  // Max audio robustness. | 116       Robustness::HW_SECURE_ALL,  // Max audio robustness. | 
| 118       Robustness::HW_SECURE_ALL,  // Max video robustness. | 117       Robustness::HW_SECURE_ALL,  // Max video robustness. | 
| 119       enable_persistent_license_support | 118       enable_persistent_license_support | 
| 120           ? EmeSessionTypeSupport::SUPPORTED | 119           ? EmeSessionTypeSupport::SUPPORTED | 
| 121           : EmeSessionTypeSupport::NOT_SUPPORTED,  // persistent-license. | 120           : EmeSessionTypeSupport::NOT_SUPPORTED,  // persistent-license. | 
| 122       EmeSessionTypeSupport::NOT_SUPPORTED,  // persistent-release-message. | 121       EmeSessionTypeSupport::NOT_SUPPORTED,  // persistent-release-message. | 
| 123       // Note: On Chromecast, all CDMs may have persistent state. | 122       // Note: On Chromecast, all CDMs may have persistent state. | 
| 124       EmeFeatureSupport::ALWAYS_ENABLED,    // Persistent state. | 123       EmeFeatureSupport::ALWAYS_ENABLED,    // Persistent state. | 
| 125       EmeFeatureSupport::ALWAYS_ENABLED));  // Distinctive identifier. | 124       EmeFeatureSupport::ALWAYS_ENABLED));  // Distinctive identifier. | 
| 126 #endif  // defined(OS_ANDROID) | 125 #endif  // defined(OS_ANDROID) | 
| 127 #endif  // defined(WIDEVINE_CDM_AVAILABLE) | 126 #endif  // defined(WIDEVINE_CDM_AVAILABLE) | 
| 128 } | 127 } | 
| 129 | 128 | 
| 130 }  // namespace shell | 129 }  // namespace media | 
| 131 }  // namespace chromecast | 130 }  // namespace chromecast | 
| OLD | NEW | 
|---|