Chromium Code Reviews| 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 MediaKeysHostMsg_CreateSession_Type session_type; | 53 MediaKeysHostMsg_CreateSession_Type session_type; |
| 54 if (type == "audio/mp4" || type == "video/mp4") { | 54 if (content_type == "audio/mp4" || content_type == "video/mp4") { |
|
ddorwin
2014/02/10 19:05:25
This should be checked elsewhere, which means we c
xhwang
2014/02/10 22:30:55
Added TODO.
| |
| 55 session_type = CREATE_SESSION_TYPE_MP4; | 55 session_type = CREATE_SESSION_TYPE_MP4; |
| 56 } else if (type == "audio/webm" || type == "video/webm") { | 56 } else if (content_type == "audio/webm" || content_type == "video/webm") { |
| 57 session_type = CREATE_SESSION_TYPE_WEBM; | 57 session_type = CREATE_SESSION_TYPE_WEBM; |
| 58 } else { | 58 } else { |
| 59 DLOG(ERROR) << "Unsupported EME CreateSession type of " << type; | 59 DLOG(ERROR) << "Unsupported EME CreateSession content type of " |
| 60 << content_type; | |
| 60 OnSessionError(session_id, media::MediaKeys::kUnknownError, 0); | 61 OnSessionError(session_id, media::MediaKeys::kUnknownError, 0); |
|
ddorwin
2014/02/10 19:05:25
I don't think we should be throwing this error.
xhwang
2014/02/10 22:30:55
Done.
| |
| 61 return false; | 62 return false; |
| 62 } | 63 } |
| 63 | 64 |
| 64 manager_->CreateSession( | 65 manager_->CreateSession( |
| 65 media_keys_id_, | 66 media_keys_id_, |
| 66 session_id, | 67 session_id, |
| 67 session_type, | 68 session_type, |
| 68 std::vector<uint8>(init_data, init_data + init_data_length)); | 69 std::vector<uint8>(init_data, init_data + init_data_length)); |
| 69 return true; | 70 return true; |
| 70 } | 71 } |
| 71 | 72 |
| 73 bool ProxyMediaKeys::LoadSession(uint32 session_id, | |
| 74 const std::string& web_session_id) { | |
| 75 DLOG(ERROR) << "ProxyMediaKeys doesn't support session loading."; | |
| 76 OnSessionError(session_id, media::MediaKeys::kUnknownError, 0); | |
| 77 return false; | |
| 78 } | |
| 79 | |
| 72 void ProxyMediaKeys::UpdateSession(uint32 session_id, | 80 void ProxyMediaKeys::UpdateSession(uint32 session_id, |
| 73 const uint8* response, | 81 const uint8* response, |
| 74 int response_length) { | 82 int response_length) { |
| 75 manager_->UpdateSession( | 83 manager_->UpdateSession( |
| 76 media_keys_id_, | 84 media_keys_id_, |
| 77 session_id, | 85 session_id, |
| 78 std::vector<uint8>(response, response + response_length)); | 86 std::vector<uint8>(response, response + response_length)); |
| 79 } | 87 } |
| 80 | 88 |
| 81 void ProxyMediaKeys::ReleaseSession(uint32 session_id) { | 89 void ProxyMediaKeys::ReleaseSession(uint32 session_id) { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 101 session_closed_cb_.Run(session_id); | 109 session_closed_cb_.Run(session_id); |
| 102 } | 110 } |
| 103 | 111 |
| 104 void ProxyMediaKeys::OnSessionError(uint32 session_id, | 112 void ProxyMediaKeys::OnSessionError(uint32 session_id, |
| 105 media::MediaKeys::KeyError error_code, | 113 media::MediaKeys::KeyError error_code, |
| 106 int system_code) { | 114 int system_code) { |
| 107 session_error_cb_.Run(session_id, error_code, system_code); | 115 session_error_cb_.Run(session_id, error_code, system_code); |
| 108 } | 116 } |
| 109 | 117 |
| 110 } // namespace content | 118 } // namespace content |
| OLD | NEW |