Merge of CLs

* Move Properties::Init into platform-specific code

  This enables a refactor where property initialization for CE CDM will
  use values provided by the application during library initialization.

  [ Merge of http://go/wvgerrit/14510/ ]

* Add Properties::AlwaysUseKeySetIds().

  When true, all sessions will have key set IDs and all session IDs
  will be the same as the corresponding key set ID.

  This will help the new CDM interface stick more closely to the EME
  APIs, in which there are no such things as key set IDs and sessions
  only have a single, random ID used for both streaming and offline.

  [ Merge of http://go/wvgerrit/14521/ ]

* Reserve key set IDs in memory, rather than on the file system.

  This makes it more efficient to use key set IDs for non-offline
  sessions.

  [ Merge of http://go/wvgerrit/14535/ ]

Change-Id: I765c3519619b17cc3c4ef95b1a6b125f479ee1d0
This commit is contained in:
Rahul Frias
2015-09-23 18:45:05 -07:00
parent ae5397ebcd
commit 3343f886a3
10 changed files with 71 additions and 48 deletions

View File

@@ -91,8 +91,13 @@ CdmResponseType CdmEngine::OpenSession(const CdmKeySystem& key_system,
return INVALID_PARAMETERS_ENG_1;
}
CdmSessionId* forced_session_id = NULL;
if (Properties::AlwaysUseKeySetIds() && !session_id->empty()) {
forced_session_id = session_id;
}
scoped_ptr<CdmSession> new_session(
new CdmSession(property_set, origin, event_listener));
new CdmSession(property_set, origin, event_listener, forced_session_id));
if (new_session->session_id().empty()) {
LOGE("CdmEngine::OpenSession: failure to generate session ID");
return EMPTY_SESSION_ID;
@@ -180,7 +185,10 @@ CdmResponseType CdmEngine::GenerateKeyRequest(
CdmSessionId id = session_id;
CdmResponseType sts;
if (license_type == kLicenseTypeRelease) {
// NOTE: If AlwaysUseKeySetIds() is true, there is no need to consult the
// release_key_sets_ map for release licenses.
if (license_type == kLicenseTypeRelease &&
!Properties::AlwaysUseKeySetIds()) {
if (key_set_id.empty()) {
LOGE("CdmEngine::GenerateKeyRequest: invalid key set ID");
return EMPTY_KEYSET_ID_ENG_2;
@@ -666,7 +674,7 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
usage_property_set_->set_security_level(kLevelDefault);
usage_property_set_->set_app_id(app_id);
usage_session_.reset(
new CdmSession(usage_property_set_.get(), EMPTY_ORIGIN, NULL));
new CdmSession(usage_property_set_.get(), EMPTY_ORIGIN, NULL, NULL));
CdmResponseType status = usage_session_->Init();
if (NO_ERROR != status) {
LOGE("CdmEngine::GetUsageInfo: session init error");
@@ -685,7 +693,7 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
usage_property_set_->set_security_level(kLevel3);
usage_property_set_->set_app_id(app_id);
usage_session_.reset(
new CdmSession(usage_property_set_.get(), EMPTY_ORIGIN, NULL));
new CdmSession(usage_property_set_.get(), EMPTY_ORIGIN, NULL, NULL));
status = usage_session_->Init();
if (NO_ERROR != status) {
LOGE("CdmEngine::GetUsageInfo: session init error");
@@ -754,7 +762,7 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
usage_property_set_->set_app_id(app_id);
usage_session_.reset(
new CdmSession(usage_property_set_.get(), EMPTY_ORIGIN, NULL));
new CdmSession(usage_property_set_.get(), EMPTY_ORIGIN, NULL, NULL));
CdmResponseType status = usage_session_->Init();
if (NO_ERROR != status) {
@@ -833,7 +841,8 @@ CdmResponseType CdmEngine::ReleaseAllUsageInfo(const std::string& app_id) {
: kLevelDefault;
usage_property_set_->set_security_level(security_level);
usage_session_.reset(
new CdmSession(usage_property_set_.get(), EMPTY_ORIGIN, NULL));
new CdmSession(usage_property_set_.get(), EMPTY_ORIGIN, NULL,
NULL));
CdmResponseType status2 = usage_session_->
DeleteMultipleUsageInformation(provider_session_tokens);
if (status2 != NO_ERROR) {