OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/crypto/proxy_media_keys.h" | 5 #include "content/renderer/media/crypto/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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 void ProxyMediaKeys::CreateSession( | 51 void ProxyMediaKeys::CreateSession( |
52 const std::string& init_data_type, | 52 const std::string& init_data_type, |
53 const uint8* init_data, | 53 const uint8* init_data, |
54 int init_data_length, | 54 int init_data_length, |
55 SessionType session_type, | 55 SessionType session_type, |
56 scoped_ptr<media::NewSessionCdmPromise> promise) { | 56 scoped_ptr<media::NewSessionCdmPromise> promise) { |
57 // TODO(xhwang): Move these checks up to blink and DCHECK here. | 57 // TODO(xhwang): Move these checks up to blink and DCHECK here. |
58 // See http://crbug.com/342510 | 58 // See http://crbug.com/342510 |
59 CdmHostMsg_CreateSession_ContentType create_session_content_type; | 59 CdmHostMsg_CreateSession_ContentType create_session_content_type; |
60 if (init_data_type == "audio/mp4" || init_data_type == "video/mp4") { | 60 if (init_data_type == "cenc") { |
61 create_session_content_type = CREATE_SESSION_TYPE_MP4; | 61 create_session_content_type = CREATE_SESSION_TYPE_MP4; |
62 } else if (init_data_type == "audio/webm" || init_data_type == "video/webm") { | 62 } else if (init_data_type == "webm") { |
63 create_session_content_type = CREATE_SESSION_TYPE_WEBM; | 63 create_session_content_type = CREATE_SESSION_TYPE_WEBM; |
64 } else { | 64 } else { |
65 DLOG(ERROR) << "Unsupported EME CreateSession content type of " | 65 DLOG(ERROR) << "Unsupported EME CreateSession content type of " |
66 << init_data_type; | 66 << init_data_type; |
67 promise->reject( | 67 promise->reject( |
68 NOT_SUPPORTED_ERROR, | 68 NOT_SUPPORTED_ERROR, |
69 0, | 69 0, |
70 "Unsupported EME CreateSession init data type of " + init_data_type); | 70 "Unsupported EME CreateSession init data type of " + init_data_type); |
71 return; | 71 return; |
72 } | 72 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 scoped_ptr<media::CdmPromise> ProxyMediaKeys::TakePromise(uint32_t session_id) { | 265 scoped_ptr<media::CdmPromise> ProxyMediaKeys::TakePromise(uint32_t session_id) { |
266 PromiseMap::iterator it = session_id_to_promise_map_.find(session_id); | 266 PromiseMap::iterator it = session_id_to_promise_map_.find(session_id); |
267 // May not be a promise associated with this session for asynchronous events. | 267 // May not be a promise associated with this session for asynchronous events. |
268 if (it == session_id_to_promise_map_.end()) | 268 if (it == session_id_to_promise_map_.end()) |
269 return scoped_ptr<media::CdmPromise>(); | 269 return scoped_ptr<media::CdmPromise>(); |
270 return session_id_to_promise_map_.take_and_erase(it); | 270 return session_id_to_promise_map_.take_and_erase(it); |
271 } | 271 } |
272 | 272 |
273 } // namespace content | 273 } // namespace content |
OLD | NEW |