OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "media/mojo/services/mojo_cdm_factory.h" | |
6 | |
7 #include "media/mojo/services/mojo_cdm.h" | |
8 | |
9 namespace media { | |
10 | |
11 int MojoCdmFactory::next_cdm_id_ = MojoCdm::kInvalidCdmId + 1; | |
ddorwin
2015/05/15 19:10:07
This somewhat assumes that the Invalid value is a
| |
12 | |
13 MojoCdmFactory::MojoCdmFactory( | |
14 mojo::ContentDecryptionModuleFactoryPtr remote_factory) | |
15 : remote_factory_(remote_factory.Pass()) { | |
16 DCHECK(remote_factory_); | |
17 } | |
18 | |
19 MojoCdmFactory::~MojoCdmFactory() { | |
20 } | |
21 | |
22 // TODO(xhwang): Pass |allow_distinctive_identifier| and | |
23 // |allow_persistent_state| down to the remote CDM. | |
24 scoped_ptr<MediaKeys> MojoCdmFactory::Create( | |
25 const std::string& key_system, | |
26 bool /* allow_distinctive_identifier */, | |
27 bool /* allow_persistent_state */, | |
28 const GURL& security_origin, | |
29 const SessionMessageCB& session_message_cb, | |
30 const SessionClosedCB& session_closed_cb, | |
31 const SessionErrorCB& session_error_cb, | |
32 const SessionKeysChangeCB& session_keys_change_cb, | |
33 const SessionExpirationUpdateCB& session_expiration_update_cb) { | |
34 DVLOG(2) << __FUNCTION__ << ": " << key_system; | |
35 | |
36 int32_t cdm_id = next_cdm_id_++; | |
37 mojo::ContentDecryptionModulePtr cdm_service; | |
38 | |
39 remote_factory_->Create(key_system, security_origin.spec(), cdm_id, | |
40 GetProxy(&cdm_service)); | |
41 | |
42 // TODO(xhwang): Handle CDM creation failure more gracefully when we switch to | |
43 // asynchronous creation. See http://crbug.com/469003 | |
44 | |
45 return make_scoped_ptr(new MojoCdm( | |
46 cdm_service.Pass(), cdm_id, session_message_cb, session_closed_cb, | |
47 session_error_cb, session_keys_change_cb, session_expiration_update_cb)); | |
48 } | |
49 | |
50 } // namespace media | |
OLD | NEW |