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

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

Issue 1427183002: Move MediaDrmBridge provision communication to native side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reformatted media/ Created 5 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android_cdm_factory.h" 5 #include "media/base/android/android_cdm_factory.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "media/base/android/media_drm_bridge.h" 8 #include "media/base/android/media_drm_bridge.h"
9 #include "media/base/android/provision_fetcher.h"
9 #include "media/base/bind_to_current_loop.h" 10 #include "media/base/bind_to_current_loop.h"
10 #include "media/base/cdm_config.h" 11 #include "media/base/cdm_config.h"
11 #include "media/base/key_systems.h" 12 #include "media/base/key_systems.h"
12 #include "third_party/widevine/cdm/widevine_cdm_common.h" 13 #include "third_party/widevine/cdm/widevine_cdm_common.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 namespace media { 16 namespace media {
16 17
17 AndroidCdmFactory::AndroidCdmFactory() {} 18 AndroidCdmFactory::AndroidCdmFactory(const CreateFetcherCB& create_fetcher_cb)
19 : create_fetcher_cb_(create_fetcher_cb) {}
18 20
19 AndroidCdmFactory::~AndroidCdmFactory() {} 21 AndroidCdmFactory::~AndroidCdmFactory() {}
20 22
21 void AndroidCdmFactory::Create( 23 void AndroidCdmFactory::Create(
22 const std::string& key_system, 24 const std::string& key_system,
23 const GURL& security_origin, 25 const GURL& security_origin,
24 const CdmConfig& cdm_config, 26 const CdmConfig& cdm_config,
25 const SessionMessageCB& session_message_cb, 27 const SessionMessageCB& session_message_cb,
26 const SessionClosedCB& session_closed_cb, 28 const SessionClosedCB& session_closed_cb,
27 const LegacySessionErrorCB& legacy_session_error_cb, 29 const LegacySessionErrorCB& legacy_session_error_cb,
(...skipping 10 matching lines...) Expand all
38 40
39 std::string error_message; 41 std::string error_message;
40 42
41 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) { 43 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) {
42 error_message = "Key system not supported unexpectedly: " + key_system; 44 error_message = "Key system not supported unexpectedly: " + key_system;
43 NOTREACHED() << error_message; 45 NOTREACHED() << error_message;
44 bound_cdm_created_cb.Run(nullptr, error_message); 46 bound_cdm_created_cb.Run(nullptr, error_message);
45 return; 47 return;
46 } 48 }
47 49
48 scoped_refptr<MediaDrmBridge> cdm( 50 scoped_refptr<MediaDrmBridge> cdm(MediaDrmBridge::Create(
49 MediaDrmBridge::Create(key_system, session_message_cb, session_closed_cb, 51 key_system, create_fetcher_cb_.Run(), session_message_cb,
50 legacy_session_error_cb, session_keys_change_cb, 52 session_closed_cb, legacy_session_error_cb, session_keys_change_cb,
51 session_expiration_update_cb)); 53 session_expiration_update_cb));
52 if (!cdm) { 54 if (!cdm) {
53 error_message = "MediaDrmBridge cannot be created for " + key_system; 55 error_message = "MediaDrmBridge cannot be created for " + key_system;
54 NOTREACHED() << error_message; 56 NOTREACHED() << error_message;
55 bound_cdm_created_cb.Run(nullptr, error_message); 57 bound_cdm_created_cb.Run(nullptr, error_message);
56 return; 58 return;
57 } 59 }
58 60
59 if (key_system == kWidevineKeySystem) { 61 if (key_system == kWidevineKeySystem) {
60 MediaDrmBridge::SecurityLevel security_level = 62 MediaDrmBridge::SecurityLevel security_level =
61 cdm_config.use_hw_secure_codecs ? MediaDrmBridge::SECURITY_LEVEL_1 63 cdm_config.use_hw_secure_codecs ? MediaDrmBridge::SECURITY_LEVEL_1
(...skipping 14 matching lines...) Expand all
76 NOTREACHED() << error_message; 78 NOTREACHED() << error_message;
77 bound_cdm_created_cb.Run(nullptr, error_message); 79 bound_cdm_created_cb.Run(nullptr, error_message);
78 return; 80 return;
79 } 81 }
80 82
81 // Success! 83 // Success!
82 bound_cdm_created_cb.Run(cdm, ""); 84 bound_cdm_created_cb.Run(cdm, "");
83 } 85 }
84 86
85 } // namespace media 87 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/android_cdm_factory.h ('k') | media/base/android/java/src/org/chromium/media/MediaDrmBridge.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698