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

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

Issue 24192004: Changes to the EME Pepper API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 months 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
Index: media/cdm/ppapi/cdm_wrapper.cc
diff --git a/media/cdm/ppapi/cdm_wrapper.cc b/media/cdm/ppapi/cdm_wrapper.cc
index 6348f1954d0e9b8c30d724e2f6bbce62a1ccb1d9..f13d4d1473f4bbe557e59f6824d776cdae4a9bf1 100644
--- a/media/cdm/ppapi/cdm_wrapper.cc
+++ b/media/cdm/ppapi/cdm_wrapper.cc
@@ -498,8 +498,8 @@ class CdmWrapper : public pp::Instance,
// PPP_ContentDecryptor_Private implementation.
// Note: Results of calls to these methods must be reported through the
// PPB_ContentDecryptor_Private interface.
- virtual void GenerateKeyRequest(const std::string& key_system,
- const std::string& type,
+ virtual void Initialize(const std::string& key_system) OVERRIDE;
+ virtual void GenerateKeyRequest(const std::string& type,
pp::VarArrayBuffer init_data) OVERRIDE;
virtual void AddKey(const std::string& session_id,
pp::VarArrayBuffer key,
@@ -636,12 +636,23 @@ bool CdmWrapper::CreateCdmInstance(const std::string& key_system) {
return (cdm_ != NULL);
}
-void CdmWrapper::GenerateKeyRequest(const std::string& key_system,
- const std::string& type,
- pp::VarArrayBuffer init_data) {
+void CdmWrapper::Initialize(const std::string& key_system) {
PP_DCHECK(!key_system.empty());
PP_DCHECK(key_system_.empty() || key_system_ == key_system);
ddorwin 2013/09/17 23:15:42 Add && cdm_ to the second clause?
jrummell 2013/09/18 21:01:15 Done.
+ if (!cdm_) {
+ if (!CreateCdmInstance(key_system)) {
+ SendUnknownKeyError(key_system, std::string());
ddorwin 2013/09/17 23:15:42 TODO: Confirm we should fire a keyerror here.
jrummell 2013/09/18 21:01:15 Done.
+ return;
+ }
+ }
+ PP_DCHECK(cdm_);
+ key_system_ = key_system;
+}
+
+void CdmWrapper::GenerateKeyRequest(const std::string& type,
+ pp::VarArrayBuffer init_data) {
+
ddorwin 2013/09/17 23:15:42 remove extra line
jrummell 2013/09/18 21:01:15 Done.
#if defined(CHECK_DOCUMENT_URL)
PP_URLComponents_Dev url_components = {};
pp::Var href = pp::URLUtil_Dev::Get()->GetDocumentURL(
@@ -652,30 +663,13 @@ void CdmWrapper::GenerateKeyRequest(const std::string& key_system,
PP_DCHECK(0 < url_components.host.len);
#endif // defined(CHECK_DOCUMENT_URL)
- if (!cdm_) {
- if (!CreateCdmInstance(key_system)) {
- SendUnknownKeyError(key_system, std::string());
- return;
- }
- }
PP_DCHECK(cdm_);
ddorwin 2013/09/17 23:15:42 remove line
jrummell 2013/09/18 21:01:15 Done.
- // Must be set here in case the CDM synchronously calls a cdm::Host method.
- // Clear below on error.
- // TODO(ddorwin): Set/clear key_system_ & cdm_ at same time; clear both on
- // error below.
- key_system_ = key_system;
cdm::Status status = cdm_->GenerateKeyRequest(
type.data(), type.size(),
static_cast<const uint8_t*>(init_data.Map()),
init_data.ByteLength());
PP_DCHECK(status == cdm::kSuccess || status == cdm::kSessionError);
- if (status != cdm::kSuccess) {
- key_system_.clear(); // See comment above.
- return;
- }
-
- key_system_ = key_system;
}
void CdmWrapper::AddKey(const std::string& session_id,

Powered by Google App Engine
This is Rietveld 408576698