Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: media/cdm/ppapi/clear_key_cdm.cc

Issue 79903002: Add decrypt-only external clear key browser tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« media/cdm/ppapi/clear_key_cdm.h ('K') | « media/cdm/ppapi/clear_key_cdm.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cdm/ppapi/clear_key_cdm.cc
diff --git a/media/cdm/ppapi/clear_key_cdm.cc b/media/cdm/ppapi/clear_key_cdm.cc
index 3728eff905543c169e6792eaca1f8886a0d656bb..91d3a46ac59b4f8607ca9d3f51c2c22b6ab88d66 100644
--- a/media/cdm/ppapi/clear_key_cdm.cc
+++ b/media/cdm/ppapi/clear_key_cdm.cc
@@ -61,6 +61,8 @@ static bool g_ffmpeg_lib_initialized = InitializeFFmpegLibraries();
const char kClearKeyCdmVersion[] = "0.1.0.1";
const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";
+const char kDecryptOnlyExternalClearKeyKeySystem[] =
+ "org.chromium.externalclearkey.decryptonly";
const int64 kSecondsPerMinute = 60;
const int64 kMsPerSecond = 1000;
const int64 kInitialTimerDelayMs = 200;
@@ -125,13 +127,15 @@ void INITIALIZE_CDM_MODULE() {
void DeinitializeCdmModule() {
}
-void* CreateCdmInstance(
- int cdm_interface_version,
- const char* key_system, uint32_t key_system_size,
- GetCdmHostFunc get_cdm_host_func, void* user_data) {
+void* CreateCdmInstance(int cdm_interface_version,
+ const char* key_system, uint32_t key_system_size,
+ GetCdmHostFunc get_cdm_host_func,
+ void* user_data) {
DVLOG(1) << "CreateCdmInstance()";
- if (std::string(key_system, key_system_size) != kExternalClearKeyKeySystem) {
+ std::string key_system_string(key_system, key_system_size);
+ if (key_system_string != kExternalClearKeyKeySystem &&
+ key_system_string != kDecryptOnlyExternalClearKeyKeySystem) {
DVLOG(1) << "Unsupported key system.";
ddorwin 2013/11/21 04:10:58 ...system: " << key_system_string;
xhwang 2013/11/22 01:47:36 Done.
return NULL;
}
@@ -144,7 +148,8 @@ void* CreateCdmInstance(
if (!host)
return NULL;
- return new media::ClearKeyCdm(host);
+ return new media::ClearKeyCdm(
+ host, key_system_string == kDecryptOnlyExternalClearKeyKeySystem);
}
const char* GetCdmVersion() {
@@ -198,12 +203,13 @@ void ClearKeyCdm::Client::SetSessionId(uint32 reference_id,
session_id_ = session_id;
}
-ClearKeyCdm::ClearKeyCdm(ClearKeyCdmHost* host)
+ClearKeyCdm::ClearKeyCdm(ClearKeyCdmHost* host, bool decrypt_only)
: decryptor_(base::Bind(&Client::KeyAdded, base::Unretained(&client_)),
base::Bind(&Client::KeyError, base::Unretained(&client_)),
base::Bind(&Client::KeyMessage, base::Unretained(&client_)),
base::Bind(&Client::SetSessionId, base::Unretained(&client_))),
host_(host),
+ decrypt_only_(decrypt_only),
timer_delay_ms_(kInitialTimerDelayMs),
timer_set_(false) {
#if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER)
@@ -352,6 +358,9 @@ cdm::Status ClearKeyCdm::Decrypt(
cdm::Status ClearKeyCdm::InitializeAudioDecoder(
const cdm::AudioDecoderConfig& audio_decoder_config) {
+ if (decrypt_only_)
+ return cdm::kSessionError;
+
#if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER)
if (!audio_decoder_)
audio_decoder_.reset(new media::FFmpegCdmAudioDecoder(host_));
@@ -373,6 +382,9 @@ cdm::Status ClearKeyCdm::InitializeAudioDecoder(
cdm::Status ClearKeyCdm::InitializeVideoDecoder(
const cdm::VideoDecoderConfig& video_decoder_config) {
+ if (decrypt_only_)
+ return cdm::kSessionError;
+
if (video_decoder_ && video_decoder_->is_initialized()) {
DCHECK(!video_decoder_->is_initialized());
return cdm::kSessionError;
« media/cdm/ppapi/clear_key_cdm.h ('K') | « media/cdm/ppapi/clear_key_cdm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698