Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: media/base/android/cdm_factory_android.cc

Issue 308073004: Add PlayerTracker and BrowserCdm interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/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> CreateBrowserCdm(
16 const std::string& key_system,
17 const SessionCreatedCB& session_created_cb,
18 const SessionMessageCB& session_message_cb,
19 const SessionReadyCB& session_ready_cb,
20 const SessionClosedCB& session_closed_cb,
21 const SessionErrorCB& session_error_cb) {
22 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) {
23 NOTREACHED() << "Unsupported key system: " << key_system;
24 return scoped_ptr<MediaKeys>();
25 }
26
27 scoped_ptr<MediaDrmBridge> cdm(MediaDrmBridge::Create(key_system,
28 session_created_cb,
29 session_message_cb,
30 session_ready_cb,
31 session_closed_cb,
32 session_error_cb));
33 if (!cdm) {
34 NOTREACHED() << "MediaDrmBridge cannot be created for " << key_system;
35 return scoped_ptr<MediaKeys>();
36 }
37
38 // TODO(xhwang/ddorwin): Pass the security level from key system.
39 MediaDrmBridge::SecurityLevel security_level =
40 MediaDrmBridge::SECURITY_LEVEL_3;
41 if (CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kMediaDrmEnableNonCompositing)) {
43 security_level = MediaDrmBridge::SECURITY_LEVEL_1;
44 }
45 if (!cdm->SetSecurityLevel(security_level)) {
46 DVLOG(1) << "failed to set security level " << security_level;
47 return scoped_ptr<MediaKeys>();
48 }
49
50 return cdm.PassAs<MediaKeys>();
51 }
52
53 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/browser_cdm_factory_android.cc ('k') | media/base/android/media_drm_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698