Index: media/cdm/ppapi/cdm_adapter.cc |
diff --git a/media/cdm/ppapi/cdm_adapter.cc b/media/cdm/ppapi/cdm_adapter.cc |
index 3fe1fad131bf541085e81c54b8ce1e78dbd033a4..603472f377984b47fd05bf61150f76e9b726ea72 100644 |
--- a/media/cdm/ppapi/cdm_adapter.cc |
+++ b/media/cdm/ppapi/cdm_adapter.cc |
@@ -248,9 +248,13 @@ bool CdmAdapter::CreateCdmInstance(const std::string& key_system) { |
return success; |
} |
-// No KeyErrors should be reported in this function because they cannot be |
-// bubbled up in the WD EME API. Those errors will be reported during session |
-// creation (CreateSession). |
+// No errors should be reported in this function because the spec says: |
+// "Store this new error object internally with the MediaKeys instance being |
+// created. This will be used to fire an error against any session created for |
+// this instance." These errors will be reported during session creation |
+// (CreateSession()) or session loading (LoadSession()). |
+// TODO(xhwang): If necessary, we need to store the error here if we want to |
+// support more delicate error reporting (other than "Unknown"). |
ddorwin
2014/02/10 23:26:24
delicate? Maybe specific?
xhwang
2014/02/10 23:42:34
Done.
xhwang
2014/02/10 23:42:34
Done.
|
void CdmAdapter::Initialize(const std::string& key_system) { |
PP_DCHECK(!key_system.empty()); |
PP_DCHECK(key_system_.empty() || (key_system_ == key_system && cdm_)); |
@@ -263,7 +267,7 @@ void CdmAdapter::Initialize(const std::string& key_system) { |
} |
void CdmAdapter::CreateSession(uint32_t session_id, |
- const std::string& type, |
+ const std::string& content_type, |
pp::VarArrayBuffer init_data) { |
// Initialize() doesn't report an error, so CreateSession() can be called |
// even if Initialize() failed. |
@@ -288,12 +292,26 @@ void CdmAdapter::CreateSession(uint32_t session_id, |
#endif // defined(CHECK_DOCUMENT_URL) |
cdm_->CreateSession(session_id, |
- type.data(), |
- type.size(), |
+ content_type.data(), |
+ content_type.size(), |
static_cast<const uint8_t*>(init_data.Map()), |
init_data.ByteLength()); |
} |
+void CdmAdapter::LoadSession(uint32_t session_id, |
+ const std::string& web_session_id) { |
+ // Initialize() doesn't report an error, so LoadSession() can be called |
+ // even if Initialize() failed. |
+ if (!cdm_) { |
+ OnSessionError(session_id, cdm::kUnknownError, 0); |
+ return; |
+ } |
+ |
+ if (!cdm_->LoadSession( |
+ session_id, web_session_id.data(), web_session_id.size())) |
+ OnSessionError(session_id, cdm::kUnknownError, 0); |
+} |
+ |
void CdmAdapter::UpdateSession(uint32_t session_id, |
pp::VarArrayBuffer response) { |
// TODO(jrummell): In EME WD, AddKey() can only be called on valid sessions. |