| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/android/proxy_media_keys.h" | 5 #include "content/renderer/media/android/proxy_media_keys.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #if defined(ENABLE_PEPPER_CDMS) | 40 #if defined(ENABLE_PEPPER_CDMS) |
| 41 NOTIMPLEMENTED(); | 41 NOTIMPLEMENTED(); |
| 42 #elif defined(OS_ANDROID) | 42 #elif defined(OS_ANDROID) |
| 43 std::vector<uint8> uuid = GetUUID(key_system); | 43 std::vector<uint8> uuid = GetUUID(key_system); |
| 44 DCHECK(!uuid.empty()); | 44 DCHECK(!uuid.empty()); |
| 45 manager_->InitializeCDM(media_keys_id_, this, uuid, frame_url); | 45 manager_->InitializeCDM(media_keys_id_, this, uuid, frame_url); |
| 46 #endif | 46 #endif |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool ProxyMediaKeys::CreateSession(uint32 session_id, | 49 bool ProxyMediaKeys::CreateSession(uint32 session_id, |
| 50 const std::string& type, | 50 const std::string& content_type, |
| 51 const uint8* init_data, | 51 const uint8* init_data, |
| 52 int init_data_length) { | 52 int init_data_length) { |
| 53 // TODO(xhwang): Move these checks up to blink and DCHECK here. |
| 54 // See http://crbug.com/342510 |
| 53 MediaKeysHostMsg_CreateSession_Type session_type; | 55 MediaKeysHostMsg_CreateSession_Type session_type; |
| 54 if (type == "audio/mp4" || type == "video/mp4") { | 56 if (content_type == "audio/mp4" || content_type == "video/mp4") { |
| 55 session_type = CREATE_SESSION_TYPE_MP4; | 57 session_type = CREATE_SESSION_TYPE_MP4; |
| 56 } else if (type == "audio/webm" || type == "video/webm") { | 58 } else if (content_type == "audio/webm" || content_type == "video/webm") { |
| 57 session_type = CREATE_SESSION_TYPE_WEBM; | 59 session_type = CREATE_SESSION_TYPE_WEBM; |
| 58 } else { | 60 } else { |
| 59 DLOG(ERROR) << "Unsupported EME CreateSession type of " << type; | 61 DLOG(ERROR) << "Unsupported EME CreateSession content type of " |
| 60 OnSessionError(session_id, media::MediaKeys::kUnknownError, 0); | 62 << content_type; |
| 61 return false; | 63 return false; |
| 62 } | 64 } |
| 63 | 65 |
| 64 manager_->CreateSession( | 66 manager_->CreateSession( |
| 65 media_keys_id_, | 67 media_keys_id_, |
| 66 session_id, | 68 session_id, |
| 67 session_type, | 69 session_type, |
| 68 std::vector<uint8>(init_data, init_data + init_data_length)); | 70 std::vector<uint8>(init_data, init_data + init_data_length)); |
| 69 return true; | 71 return true; |
| 70 } | 72 } |
| 71 | 73 |
| 74 void ProxyMediaKeys::LoadSession(uint32 session_id, |
| 75 const std::string& web_session_id) { |
| 76 // TODO(xhwang): Check key system and platform support for LoadSession in |
| 77 // blink and add NOTREACHED() here. |
| 78 DLOG(ERROR) << "ProxyMediaKeys doesn't support session loading."; |
| 79 OnSessionError(session_id, media::MediaKeys::kUnknownError, 0); |
| 80 } |
| 81 |
| 72 void ProxyMediaKeys::UpdateSession(uint32 session_id, | 82 void ProxyMediaKeys::UpdateSession(uint32 session_id, |
| 73 const uint8* response, | 83 const uint8* response, |
| 74 int response_length) { | 84 int response_length) { |
| 75 manager_->UpdateSession( | 85 manager_->UpdateSession( |
| 76 media_keys_id_, | 86 media_keys_id_, |
| 77 session_id, | 87 session_id, |
| 78 std::vector<uint8>(response, response + response_length)); | 88 std::vector<uint8>(response, response + response_length)); |
| 79 } | 89 } |
| 80 | 90 |
| 81 void ProxyMediaKeys::ReleaseSession(uint32 session_id) { | 91 void ProxyMediaKeys::ReleaseSession(uint32 session_id) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 101 session_closed_cb_.Run(session_id); | 111 session_closed_cb_.Run(session_id); |
| 102 } | 112 } |
| 103 | 113 |
| 104 void ProxyMediaKeys::OnSessionError(uint32 session_id, | 114 void ProxyMediaKeys::OnSessionError(uint32 session_id, |
| 105 media::MediaKeys::KeyError error_code, | 115 media::MediaKeys::KeyError error_code, |
| 106 int system_code) { | 116 int system_code) { |
| 107 session_error_cb_.Run(session_id, error_code, system_code); | 117 session_error_cb_.Run(session_id, error_code, system_code); |
| 108 } | 118 } |
| 109 | 119 |
| 110 } // namespace content | 120 } // namespace content |
| OLD | NEW |