Chromium Code Reviews| 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..49c1130e606cf25491671b36b591bdefb5d9aa15 100644 |
| --- a/media/cdm/ppapi/cdm_adapter.cc |
| +++ b/media/cdm/ppapi/cdm_adapter.cc |
| @@ -250,7 +250,7 @@ bool CdmAdapter::CreateCdmInstance(const std::string& key_system) { |
| // 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). |
| +// creation (CreateSession()) or session loading (LoadSession()). |
|
ddorwin
2014/02/10 19:05:25
Technically, the spec says errors are to be saved
xhwang
2014/02/10 22:30:55
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 +263,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 +288,25 @@ 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_ || |
|
ddorwin
2014/02/10 19:05:25
These two reasons for returning an error are disti
xhwang
2014/02/10 22:30:55
Done.
|
| + cdm_->GetCdmVersion() < cdm::ContentDecryptionModule_4::kVersion) { |
|
xhwang
2014/02/08 01:05:25
Currently CdmWrapper doesn't have access to SendSe
ddorwin
2014/02/10 19:05:25
Would it be better to temporarily add a bool retur
xhwang
2014/02/10 22:30:55
Done.
|
| + OnSessionError(session_id, cdm::kUnknownError, 0); |
| + return; |
| + } |
| + |
| + cdm_->LoadSession(session_id, web_session_id.data(), web_session_id.size()); |
| +} |
| + |
| void CdmAdapter::UpdateSession(uint32_t session_id, |
| pp::VarArrayBuffer response) { |
| // TODO(jrummell): In EME WD, AddKey() can only be called on valid sessions. |