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 "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/android/provision_fetcher.h" | |
11 #include "media/base/media_switches.h" | 12 #include "media/base/media_switches.h" |
12 #include "third_party/widevine/cdm/widevine_cdm_common.h" | 13 #include "third_party/widevine/cdm/widevine_cdm_common.h" |
13 | 14 |
14 namespace media { | 15 namespace media { |
15 | 16 |
16 ScopedBrowserCdmPtr BrowserCdmFactoryAndroid::CreateBrowserCdm( | 17 ScopedBrowserCdmPtr BrowserCdmFactoryAndroid::CreateBrowserCdm( |
17 const std::string& key_system, | 18 const std::string& key_system, |
18 bool use_hw_secure_codecs, | 19 bool use_hw_secure_codecs, |
19 const SessionMessageCB& session_message_cb, | 20 const SessionMessageCB& session_message_cb, |
20 const SessionClosedCB& session_closed_cb, | 21 const SessionClosedCB& session_closed_cb, |
21 const LegacySessionErrorCB& legacy_session_error_cb, | 22 const LegacySessionErrorCB& legacy_session_error_cb, |
22 const SessionKeysChangeCB& session_keys_change_cb, | 23 const SessionKeysChangeCB& session_keys_change_cb, |
23 const SessionExpirationUpdateCB& session_expiration_update_cb) { | 24 const SessionExpirationUpdateCB& session_expiration_update_cb) { |
24 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) { | 25 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) { |
25 NOTREACHED() << "Key system not supported unexpectedly: " << key_system; | 26 NOTREACHED() << "Key system not supported unexpectedly: " << key_system; |
26 return ScopedBrowserCdmPtr(); | 27 return ScopedBrowserCdmPtr(); |
27 } | 28 } |
28 | 29 |
29 ScopedMediaDrmBridgePtr cdm( | 30 scoped_ptr<ProvisionFetcher> provision_fetcher = |
30 MediaDrmBridge::Create(key_system, session_message_cb, session_closed_cb, | 31 ProvisionFetcher::GetFactory()->CreateFetcher(); |
31 legacy_session_error_cb, session_keys_change_cb, | 32 |
32 session_expiration_update_cb)); | 33 ScopedMediaDrmBridgePtr cdm(MediaDrmBridge::Create( |
34 key_system, provision_fetcher.Pass(), session_message_cb, | |
xhwang
2015/11/02 20:37:04
ditto, can we create ProvisionFetcher in MDB so we
Tima Vaisburd
2015/11/05 02:24:07
For this path |provision_fetcher| is now created i
| |
35 session_closed_cb, legacy_session_error_cb, session_keys_change_cb, | |
36 session_expiration_update_cb)); | |
33 if (!cdm) { | 37 if (!cdm) { |
34 NOTREACHED() << "MediaDrmBridge cannot be created for " << key_system; | 38 NOTREACHED() << "MediaDrmBridge cannot be created for " << key_system; |
35 return ScopedBrowserCdmPtr(); | 39 return ScopedBrowserCdmPtr(); |
36 } | 40 } |
37 | 41 |
38 if (key_system == kWidevineKeySystem) { | 42 if (key_system == kWidevineKeySystem) { |
39 MediaDrmBridge::SecurityLevel security_level = | 43 MediaDrmBridge::SecurityLevel security_level = |
40 use_hw_secure_codecs ? MediaDrmBridge::SECURITY_LEVEL_1 | 44 use_hw_secure_codecs ? MediaDrmBridge::SECURITY_LEVEL_1 |
41 : MediaDrmBridge::SECURITY_LEVEL_3; | 45 : MediaDrmBridge::SECURITY_LEVEL_3; |
42 if (!cdm->SetSecurityLevel(security_level)) { | 46 if (!cdm->SetSecurityLevel(security_level)) { |
43 DVLOG(1) << "failed to set security level " << security_level; | 47 DVLOG(1) << "failed to set security level " << security_level; |
44 return ScopedBrowserCdmPtr(); | 48 return ScopedBrowserCdmPtr(); |
45 } | 49 } |
46 } else { | 50 } else { |
47 // Assume other key systems require hardware-secure codecs and thus do not | 51 // Assume other key systems require hardware-secure codecs and thus do not |
48 // support full compositing. | 52 // support full compositing. |
49 if (!use_hw_secure_codecs) { | 53 if (!use_hw_secure_codecs) { |
50 NOTREACHED() | 54 NOTREACHED() |
51 << key_system | 55 << key_system |
52 << " may require use_video_overlay_for_embedded_encrypted_video"; | 56 << " may require use_video_overlay_for_embedded_encrypted_video"; |
53 return ScopedBrowserCdmPtr(); | 57 return ScopedBrowserCdmPtr(); |
54 } | 58 } |
55 } | 59 } |
56 | 60 |
57 return cdm.Pass(); | 61 return cdm.Pass(); |
58 } | 62 } |
59 | 63 |
60 } // namespace media | 64 } // namespace media |
OLD | NEW |