Chromium Code Reviews| Index: content/browser/media/android/browser_media_player_manager.cc |
| diff --git a/content/browser/media/android/browser_media_player_manager.cc b/content/browser/media/android/browser_media_player_manager.cc |
| index aadc6a3544e2a01c6dad20cf68766b136d9b03b0..e3020c3f5f66516ef4fc0a05755928467737dcfc 100644 |
| --- a/content/browser/media/android/browser_media_player_manager.cc |
| +++ b/content/browser/media/android/browser_media_player_manager.cc |
| @@ -606,7 +606,7 @@ void BrowserMediaPlayerManager::OnInitializeCDM( |
| void BrowserMediaPlayerManager::OnCreateSession( |
| int media_keys_id, |
| uint32 session_id, |
| - MediaKeysHostMsg_CreateSession_Type type, |
| + MediaKeysHostMsg_CreateSession_Type content_type, |
| const std::vector<uint8>& init_data) { |
| if (init_data.size() > kEmeInitDataMaximum) { |
| LOG(WARNING) << "InitData for ID: " << media_keys_id |
| @@ -616,11 +616,12 @@ void BrowserMediaPlayerManager::OnCreateSession( |
| return; |
| } |
| - // Convert the session type into a MIME type. "audio" and "video" don't |
| - // matter, so using "video" for the MIME type. |
| - // Ref: https://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#dom-createsession |
| + // Convert the session content type into a MIME type. "audio" and "video" |
| + // don't matter, so using "video" for the MIME type. |
| + // Ref: |
| + // https://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#dom-createsession |
|
ddorwin
2014/02/10 19:05:25
s/tip/default/ wherever you see it.
xhwang
2014/02/10 22:30:55
Done.
|
| std::string mime_type; |
| - switch (type) { |
| + switch (content_type) { |
| case CREATE_SESSION_TYPE_WEBM: |
| mime_type = "video/webm"; |
| break; |
| @@ -822,7 +823,7 @@ void BrowserMediaPlayerManager::OnSetMediaKeys(int player_id, |
| void BrowserMediaPlayerManager::CreateSessionIfPermitted( |
| int media_keys_id, |
| uint32 session_id, |
| - const std::string& type, |
| + const std::string& content_type, |
| const std::vector<uint8>& init_data, |
| bool permitted) { |
| if (!permitted) { |
| @@ -840,7 +841,15 @@ void BrowserMediaPlayerManager::CreateSessionIfPermitted( |
| } |
| media_keys_ids_pending_approval_.erase(media_keys_id); |
| media_keys_ids_approved_.insert(media_keys_id); |
| - drm_bridge->CreateSession(session_id, type, &init_data[0], init_data.size()); |
| + |
| + if (!drm_bridge->CreateSession( |
| + session_id, content_type, &init_data[0], init_data.size())) { |
| + OnSessionError( |
| + media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); |
| + return; |
| + } |
| + |
| + // TODO(xhwang): Move the following code to OnSessionReady. |
| // TODO(qinmin): currently |media_keys_id| and player ID are identical. |
| // This might not be true in the future. |