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

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: Addressed more comments 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() {}
18 19
(...skipping 19 matching lines...) Expand all
38 39
39 std::string error_message; 40 std::string error_message;
40 41
41 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) { 42 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) {
42 error_message = "Key system not supported unexpectedly: " + key_system; 43 error_message = "Key system not supported unexpectedly: " + key_system;
43 NOTREACHED() << error_message; 44 NOTREACHED() << error_message;
44 bound_cdm_created_cb.Run(nullptr, error_message); 45 bound_cdm_created_cb.Run(nullptr, error_message);
45 return; 46 return;
46 } 47 }
47 48
49 DCHECK(provision_fetcher_);
50
48 scoped_refptr<MediaDrmBridge> cdm( 51 scoped_refptr<MediaDrmBridge> cdm(
49 MediaDrmBridge::Create(key_system, session_message_cb, session_closed_cb, 52 MediaDrmBridge::Create(key_system, provision_fetcher_.Pass(),
xhwang 2015/11/11 09:53:21 We could use the same AndroidCdmFactory to create
Tima Vaisburd 2015/11/11 23:26:35 Made another class - ProvisionFetcherFactory - and
xhwang 2015/11/12 22:27:03 I don't think MDB would allow >1 provisioning proc
Tima Vaisburd 2015/11/13 03:13:10 Yes, I removed ProvisionFetcherFactory altogether.
53 session_message_cb, session_closed_cb,
50 legacy_session_error_cb, session_keys_change_cb, 54 legacy_session_error_cb, session_keys_change_cb,
51 session_expiration_update_cb)); 55 session_expiration_update_cb));
52 if (!cdm) { 56 if (!cdm) {
53 error_message = "MediaDrmBridge cannot be created for " + key_system; 57 error_message = "MediaDrmBridge cannot be created for " + key_system;
54 NOTREACHED() << error_message; 58 NOTREACHED() << error_message;
55 bound_cdm_created_cb.Run(nullptr, error_message); 59 bound_cdm_created_cb.Run(nullptr, error_message);
56 return; 60 return;
57 } 61 }
58 62
59 if (key_system == kWidevineKeySystem) { 63 if (key_system == kWidevineKeySystem) {
(...skipping 15 matching lines...) Expand all
75 " may require use_video_overlay_for_embedded_encrypted_video"; 79 " may require use_video_overlay_for_embedded_encrypted_video";
76 NOTREACHED() << error_message; 80 NOTREACHED() << error_message;
77 bound_cdm_created_cb.Run(nullptr, error_message); 81 bound_cdm_created_cb.Run(nullptr, error_message);
78 return; 82 return;
79 } 83 }
80 84
81 // Success! 85 // Success!
82 bound_cdm_created_cb.Run(cdm, ""); 86 bound_cdm_created_cb.Run(cdm, "");
83 } 87 }
84 88
89 void AndroidCdmFactory::SetProvisionFetcher(
90 scoped_ptr<ProvisionFetcher> provision_fetcher) {
91 DCHECK(!provision_fetcher_);
92 provision_fetcher_ = provision_fetcher.Pass();
93 }
94
85 } // namespace media 95 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698