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

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

Issue 850183002: media: Support unprefixed EME API on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 11 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
OLDNEW
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 "media/base/android/browser_cdm_factory_android.h" 5 #include "media/base/android/browser_cdm_factory_android.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/android/media_drm_bridge.h" 10 #include "media/base/android/media_drm_bridge.h"
11 #include "media/base/media_switches.h" 11 #include "media/base/media_switches.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 scoped_ptr<BrowserCdm> BrowserCdmFactoryAndroid::CreateBrowserCdm( 15 scoped_ptr<BrowserCdm> BrowserCdmFactoryAndroid::CreateBrowserCdm(
16 const std::string& key_system, 16 const std::string& key_system,
17 const BrowserCdm::SessionCreatedCB& session_created_cb, 17 const SessionMessageCB& session_message_cb,
18 const BrowserCdm::SessionMessageCB& session_message_cb, 18 const SessionClosedCB& session_closed_cb,
19 const BrowserCdm::SessionReadyCB& session_ready_cb, 19 const SessionErrorCB& session_error_cb,
20 const BrowserCdm::SessionClosedCB& session_closed_cb, 20 const SessionKeysChangeCB& session_keys_change_cb,
21 const BrowserCdm::SessionErrorCB& session_error_cb) { 21 const SessionExpirationUpdateCB& session_expiration_update_cb) {
22 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) { 22 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) {
23 NOTREACHED() << "Unsupported key system: " << key_system; 23 NOTREACHED() << "Unsupported key system: " << key_system;
24 return scoped_ptr<BrowserCdm>(); 24 return scoped_ptr<BrowserCdm>();
25 } 25 }
26 26
27 scoped_ptr<MediaDrmBridge> cdm(MediaDrmBridge::Create(key_system, 27 scoped_ptr<MediaDrmBridge> cdm(MediaDrmBridge::Create(
28 session_created_cb, 28 key_system, session_message_cb, session_closed_cb, session_error_cb,
29 session_message_cb, 29 session_keys_change_cb, session_expiration_update_cb));
30 session_ready_cb,
31 session_closed_cb,
32 session_error_cb));
33 if (!cdm) { 30 if (!cdm) {
34 NOTREACHED() << "MediaDrmBridge cannot be created for " << key_system; 31 NOTREACHED() << "MediaDrmBridge cannot be created for " << key_system;
35 return scoped_ptr<BrowserCdm>(); 32 return scoped_ptr<BrowserCdm>();
36 } 33 }
37 34
38 // TODO(xhwang/ddorwin): Pass the security level from key system. 35 // TODO(xhwang/ddorwin): Pass the security level from key system.
39 MediaDrmBridge::SecurityLevel security_level = 36 MediaDrmBridge::SecurityLevel security_level =
40 MediaDrmBridge::SECURITY_LEVEL_3; 37 MediaDrmBridge::SECURITY_LEVEL_3;
41 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 38 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kMediaDrmEnableNonCompositing)) { 39 switches::kMediaDrmEnableNonCompositing)) {
43 security_level = MediaDrmBridge::SECURITY_LEVEL_1; 40 security_level = MediaDrmBridge::SECURITY_LEVEL_1;
44 } 41 }
45 if (!cdm->SetSecurityLevel(security_level)) { 42 if (!cdm->SetSecurityLevel(security_level)) {
46 DVLOG(1) << "failed to set security level " << security_level; 43 DVLOG(1) << "failed to set security level " << security_level;
47 return scoped_ptr<BrowserCdm>(); 44 return scoped_ptr<BrowserCdm>();
48 } 45 }
49 46
50 return cdm.Pass(); 47 return cdm.Pass();
51 } 48 }
52 49
53 } // namespace media 50 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698