forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
media: Add External Clear Key content browser test on Android
This CL adds External Clear Key support on Android for testing. This is implemented by running AesDecryptor in the MojoCdmService, which runs in the MojoMediaApplication in the GPU process. This is only enabled when kExternalClearKeyForTesting feature is enabled. A new content browser test is added to use External Clear Key on Android. Since AesDecryptor doesn't support decoding, the media pipeline is configured to do decrypt-only using the mojo CDM (MojoDecryptor on MojoCdm), and then use the normal Android pipeline (AVDA/MojoAudioDecoder) to decode encrypted audio/video. Note that this is different from the default mode how Android media pipeline works for encrypted content (decryption/decoding both happens in the GPU process). When browser_tests are enabled on Android, we should be able to have test coverage on that. Here's what the new test covers: - MojoCdm / MojoCdmService - MojoDecryptor / MojoDecryptorService - MojoMediaApplication - Connection to services hosted in MojoMediaApplication through MojoShellContext. This CL also fixes a bug in MojoCdm where the decryptor_ptr is bound to one thread but is used on another thread. BUG=581893 TEST=This CL adds a new test. No other functionality change. Review-Url: https://codereview.chromium.org/2268283003 Cr-Commit-Position: refs/heads/master@{#420500}
- Loading branch information
1 parent
70e44d1
commit bcd6858
Showing
14 changed files
with
240 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
components/cdm/renderer/external_clear_key_key_system_properties.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "components/cdm/renderer/external_clear_key_key_system_properties.h" | ||
|
||
#include "base/logging.h" | ||
#include "media/base/eme_constants.h" | ||
|
||
namespace cdm { | ||
|
||
#if defined(ENABLE_PEPPER_CDMS) | ||
const char kExternalClearKeyPepperType[] = "application/x-ppapi-clearkey-cdm"; | ||
#endif | ||
|
||
ExternalClearKeyProperties::ExternalClearKeyProperties( | ||
const std::string& key_system_name) | ||
: key_system_name_(key_system_name) {} | ||
|
||
ExternalClearKeyProperties::~ExternalClearKeyProperties() {} | ||
|
||
std::string ExternalClearKeyProperties::GetKeySystemName() const { | ||
return key_system_name_; | ||
} | ||
|
||
bool ExternalClearKeyProperties::IsSupportedInitDataType( | ||
media::EmeInitDataType init_data_type) const { | ||
switch (init_data_type) { | ||
case media::EmeInitDataType::WEBM: | ||
case media::EmeInitDataType::KEYIDS: | ||
return true; | ||
|
||
case media::EmeInitDataType::CENC: | ||
#if defined(USE_PROPRIETARY_CODECS) | ||
return true; | ||
#else | ||
return false; | ||
#endif // defined(USE_PROPRIETARY_CODECS) | ||
|
||
case media::EmeInitDataType::UNKNOWN: | ||
return false; | ||
} | ||
NOTREACHED(); | ||
return false; | ||
} | ||
|
||
media::SupportedCodecs ExternalClearKeyProperties::GetSupportedCodecs() const { | ||
#if defined(USE_PROPRIETARY_CODECS) | ||
return media::EME_CODEC_MP4_ALL | media::EME_CODEC_WEBM_ALL; | ||
#else | ||
return media::EME_CODEC_WEBM_ALL; | ||
#endif | ||
} | ||
|
||
media::EmeConfigRule ExternalClearKeyProperties::GetRobustnessConfigRule( | ||
media::EmeMediaType media_type, | ||
const std::string& requested_robustness) const { | ||
return requested_robustness.empty() ? media::EmeConfigRule::SUPPORTED | ||
: media::EmeConfigRule::NOT_SUPPORTED; | ||
} | ||
|
||
// Persistent license sessions are faked. | ||
media::EmeSessionTypeSupport | ||
ExternalClearKeyProperties::GetPersistentLicenseSessionSupport() const { | ||
return media::EmeSessionTypeSupport::SUPPORTED; | ||
} | ||
|
||
media::EmeSessionTypeSupport | ||
ExternalClearKeyProperties::GetPersistentReleaseMessageSessionSupport() const { | ||
return media::EmeSessionTypeSupport::NOT_SUPPORTED; | ||
} | ||
|
||
media::EmeFeatureSupport ExternalClearKeyProperties::GetPersistentStateSupport() | ||
const { | ||
return media::EmeFeatureSupport::REQUESTABLE; | ||
} | ||
|
||
media::EmeFeatureSupport | ||
ExternalClearKeyProperties::GetDistinctiveIdentifierSupport() const { | ||
return media::EmeFeatureSupport::NOT_SUPPORTED; | ||
} | ||
|
||
#if defined(ENABLE_PEPPER_CDMS) | ||
std::string ExternalClearKeyProperties::GetPepperType() const { | ||
return kExternalClearKeyPepperType; | ||
} | ||
#endif | ||
|
||
} // namespace cdm |
48 changes: 48 additions & 0 deletions
48
components/cdm/renderer/external_clear_key_key_system_properties.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef COMPONENTS_CDM_RENDERER_EXTERNAL_CLEAR_KEY_KEY_SYSTEM_PROPERTIES_H_ | ||
#define COMPONENTS_CDM_RENDERER_EXTERNAL_CLEAR_KEY_KEY_SYSTEM_PROPERTIES_H_ | ||
|
||
#include <string> | ||
|
||
#include "build/build_config.h" | ||
#include "media/base/key_system_properties.h" | ||
|
||
namespace cdm { | ||
|
||
#if defined(ENABLE_PEPPER_CDMS) | ||
extern const char kExternalClearKeyPepperType[]; | ||
#endif | ||
|
||
// KeySystemProperties implementation for external Clear Key key systems. | ||
class ExternalClearKeyProperties : public media::KeySystemProperties { | ||
public: | ||
explicit ExternalClearKeyProperties(const std::string& key_system_name); | ||
~ExternalClearKeyProperties() override; | ||
|
||
std::string GetKeySystemName() const override; | ||
bool IsSupportedInitDataType( | ||
media::EmeInitDataType init_data_type) const override; | ||
media::SupportedCodecs GetSupportedCodecs() const override; | ||
media::EmeConfigRule GetRobustnessConfigRule( | ||
media::EmeMediaType media_type, | ||
const std::string& requested_robustness) const override; | ||
media::EmeSessionTypeSupport GetPersistentLicenseSessionSupport() | ||
const override; | ||
media::EmeSessionTypeSupport GetPersistentReleaseMessageSessionSupport() | ||
const override; | ||
media::EmeFeatureSupport GetPersistentStateSupport() const override; | ||
media::EmeFeatureSupport GetDistinctiveIdentifierSupport() const override; | ||
#if defined(ENABLE_PEPPER_CDMS) | ||
std::string GetPepperType() const override; | ||
#endif | ||
|
||
private: | ||
const std::string key_system_name_; | ||
}; | ||
|
||
} // namespace cdm | ||
|
||
#endif // COMPONENTS_CDM_RENDERER_EXTERNAL_CLEAR_KEY_KEY_SYSTEM_PROPERTIES_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.