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/base/android/cdm_factory.h" | |
6 | |
7 #include "base/command_line.h" | |
8 #include "base/logging.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "media/base/android/media_drm_bridge.h" | |
11 #include "media/base/media_switches.h" | |
12 | |
13 namespace media { | |
14 | |
15 scoped_ptr<MediaKeys> CreateCdm(const std::string& key_system, | |
16 const SessionCreatedCB& session_created_cb, | |
17 const SessionMessageCB& session_message_cb, | |
18 const SessionReadyCB& session_ready_cb, | |
19 const SessionClosedCB& session_closed_cb, | |
20 const SessionErrorCB& session_error_cb) { | |
21 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) { | |
22 NOTREACHED() << "Unsupported key system: " << key_system; | |
23 return scoped_ptr<MediaKeys>(); | |
24 } | |
25 | |
26 scoped_ptr<MediaDrmBridge> cdm(MediaDrmBridge::Create(key_system, | |
ddorwin
2014/05/13 00:59:38
Are we sure this will never fail? The returned val
xhwang
2014/05/14 16:42:06
Done.
| |
27 session_created_cb, | |
28 session_message_cb, | |
29 session_ready_cb, | |
30 session_closed_cb, | |
31 session_error_cb)); | |
32 | |
33 // TODO(xhwang/ddorwin): Pass the security level from key system. | |
34 MediaDrmBridge::SecurityLevel security_level = | |
35 MediaDrmBridge::SECURITY_LEVEL_3; | |
36 if (CommandLine::ForCurrentProcess() | |
37 ->HasSwitch(switches::kMediaDrmEnableNonCompositing)) { | |
damienv1
2014/05/12 21:37:53
nit: looks weird to break the line on "->". Would
xhwang
2014/05/14 16:42:06
Done.
| |
38 security_level = MediaDrmBridge::SECURITY_LEVEL_1; | |
39 } | |
40 if (!cdm->SetSecurityLevel(security_level)) { | |
41 DVLOG(1) << "failed to set security level " << security_level; | |
42 return scoped_ptr<MediaKeys>(); | |
43 } | |
44 | |
45 return cdm.PassAs<MediaKeys>(); | |
46 } | |
47 | |
48 } // namespace media | |
OLD | NEW |