Commit b8e8c6fe authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

media: Add kHardwareSecureDecryption feature

For now this is used as the flag to enable hardware secure decryption
support on Windows while it's still under development.

Added a TODO to apply this flag to Android and ChromeOS where hardware
secure decryption is already supported.

Bug: 848532
Test: No functionality change.
Change-Id: Ie263008ace5f8da5da1ab94acf22485046a79b7d
Reviewed-on: https://chromium-review.googlesource.com/1103283
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568316}
parent a2c7b14a
......@@ -237,17 +237,33 @@ static void AddWidevine(
return;
}
// Codecs and encryption schemes.
auto supported_codecs = GetSupportedCodecs(capability->video_codecs);
const auto& supported_encryption_schemes = capability->encryption_schemes;
// On ChromeOS, we do not have real hardware secure codecs. But this does not
// affect HW_SECURE* support since the support doesn't require hardware secure
// codecs. See WidevineKeySystemProperties::GetRobustnessConfigRule().
auto supported_hw_secure_codecs =
GetSupportedCodecs(capability->hw_secure_video_codecs);
// TODO(crbug.com/853261): Support capability->hw_secure_encryption_schemes.
// TODO(crbug.com/853261): Support capability->hw_secure_encryption_schemes
// and pass it into WidevineKeySystemProperties.
// Robustness.
using Robustness = cdm::WidevineKeySystemProperties::Robustness;
auto max_audio_robustness = Robustness::SW_SECURE_CRYPTO;
auto max_video_robustness = Robustness::SW_SECURE_DECODE;
#if defined(OS_CHROMEOS)
// On ChromeOS, we support HW_SECURE_ALL even without hardware secure codecs.
// See WidevineKeySystemProperties::GetRobustnessConfigRule().
max_audio_robustness = Robustness::HW_SECURE_ALL;
max_video_robustness = Robustness::HW_SECURE_ALL;
#else
if (base::FeatureList::IsEnabled(media::kHardwareSecureDecryption)) {
max_audio_robustness = Robustness::HW_SECURE_CRYPTO;
max_video_robustness = Robustness::HW_SECURE_ALL;
}
#endif
// Session types.
bool cdm_supports_temporary_session = base::ContainsValue(
capability->session_types, media::CdmSessionType::TEMPORARY_SESSION);
if (!cdm_supports_temporary_session) {
......@@ -260,28 +276,21 @@ static void AddWidevine(
media::CdmSessionType::PERSISTENT_LICENSE_SESSION);
auto persistent_license_support =
GetPersistentLicenseSupport(cdm_supports_persistent_license);
auto persistent_release_message_support =
EmeSessionTypeSupport::NOT_SUPPORTED;
using Robustness = cdm::WidevineKeySystemProperties::Robustness;
// Others.
auto persistent_state_support = EmeFeatureSupport::REQUESTABLE;
auto distinctive_identifier_support = EmeFeatureSupport::NOT_SUPPORTED;
#if defined(OS_CHROMEOS)
distinctive_identifier_support = EmeFeatureSupport::REQUESTABLE;
#endif
// TODO(xhwang/jrummell): Parse hw_secure_encryption_schemes.
concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties(
supported_encryption_schemes, supported_codecs,
supported_hw_secure_codecs,
#if defined(OS_CHROMEOS)
Robustness::HW_SECURE_ALL, // Maximum audio robustness.
Robustness::HW_SECURE_ALL, // Maximum video robustness.
persistent_license_support, // Persistent-license.
EmeSessionTypeSupport::NOT_SUPPORTED, // Persistent-release-message.
EmeFeatureSupport::REQUESTABLE, // Persistent state.
EmeFeatureSupport::REQUESTABLE)); // Distinctive identifier.
#else // Desktop
Robustness::SW_SECURE_CRYPTO, // Maximum audio robustness.
Robustness::SW_SECURE_DECODE, // Maximum video robustness.
persistent_license_support, // persistent-license.
EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message.
EmeFeatureSupport::REQUESTABLE, // Persistent state.
EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier.
#endif // defined(OS_CHROMEOS)
supported_hw_secure_codecs, max_audio_robustness, max_video_robustness,
persistent_license_support, persistent_release_message_support,
persistent_state_support, distinctive_identifier_support));
}
#endif // defined(WIDEVINE_CDM_AVAILABLE)
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
......
......@@ -7,12 +7,14 @@
#include <vector>
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "content/public/browser/cdm_registry.h"
#include "content/public/common/cdm_info.h"
#include "media/base/key_system_names.h"
#include "media/base/key_systems.h"
#include "media/base/media_switches.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
namespace content {
......@@ -77,7 +79,11 @@ void KeySystemSupportImpl::IsKeySystemSupported(
capability->encryption_schemes =
std::vector<media::EncryptionMode>(schemes.begin(), schemes.end());
// TODO(xhwang): Populate hw_secure* fields on Windows.
if (base::FeatureList::IsEnabled(media::kHardwareSecureDecryption)) {
// TODO(xhwang): Call into GetContentClient()->browser() to get key system
// specific hardware secure decryption capability on Windows.
NOTIMPLEMENTED();
}
// Temporary session is always supported.
// TODO(xhwang): Populate this from CdmInfo.
......
......@@ -321,6 +321,13 @@ const base::Feature kVideoBlitColorAccuracy{"video-blit-color-accuracy",
const base::Feature kExternalClearKeyForTesting{
"ExternalClearKeyForTesting", base::FEATURE_DISABLED_BY_DEFAULT};
// Enables hardware secure decryption if supported by hardware and CDM.
// TODO(xhwang): Currently this is only used for development of new features.
// Apply this to Android and ChromeOS as well where hardware secure decryption
// is already available.
const base::Feature kHardwareSecureDecryption{
"HardwareSecureDecryption", base::FEATURE_DISABLED_BY_DEFAULT};
// Enables low-delay video rendering in media pipeline on "live" stream.
const base::Feature kLowDelayVideoRenderingOnLiveStream{
"low-delay-video-rendering-on-live-stream",
......
......@@ -109,6 +109,7 @@ MEDIA_EXPORT extern const base::Feature kBackgroundVideoPauseOptimization;
MEDIA_EXPORT extern const base::Feature kBackgroundVideoTrackOptimization;
MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoder;
MEDIA_EXPORT extern const base::Feature kExternalClearKeyForTesting;
MEDIA_EXPORT extern const base::Feature kHardwareSecureDecryption;
MEDIA_EXPORT extern const base::Feature kLowDelayVideoRenderingOnLiveStream;
MEDIA_EXPORT extern const base::Feature kMediaCastOverlayButton;
MEDIA_EXPORT extern const base::Feature kRecordMediaEngagementScores;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment