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

Side by Side Diff: media/base/android/media_drm_bridge.h

Issue 930413003: MediaDrm: Only apply Widevine security levels to the Widevine key system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "media/base/browser_cdm.h" 15 #include "media/base/browser_cdm.h"
16 #include "media/base/cdm_promise_adapter.h" 16 #include "media/base/cdm_promise_adapter.h"
17 #include "media/base/media_export.h" 17 #include "media/base/media_export.h"
18 #include "media/cdm/player_tracker_impl.h" 18 #include "media/cdm/player_tracker_impl.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 class GURL; 21 class GURL;
22 22
23 namespace media { 23 namespace media {
24 24
25 class MediaPlayerManager; 25 class MediaPlayerManager;
26 26
27 // This class provides DRM services for android EME implementation. 27 // This class provides DRM services for android EME implementation.
28 class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { 28 class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
29 public: 29 public:
30 // TODO(ddorwin): These are specific to Widevine. http://crbug.com/459400
30 enum SecurityLevel { 31 enum SecurityLevel {
31 SECURITY_LEVEL_NONE = 0, 32 SECURITY_LEVEL_NONE = 0,
32 SECURITY_LEVEL_1 = 1, 33 SECURITY_LEVEL_1 = 1,
33 SECURITY_LEVEL_3 = 3, 34 SECURITY_LEVEL_3 = 3,
34 }; 35 };
35 36
36 typedef base::Callback<void(bool)> ResetCredentialsCB; 37 typedef base::Callback<void(bool)> ResetCredentialsCB;
37 38
38 ~MediaDrmBridge() override; 39 ~MediaDrmBridge() override;
39 40
40 // Checks whether MediaDRM is available. 41 // Checks whether MediaDRM is available.
41 // All other static methods check IsAvailable() internally. There's no need 42 // All other static methods check IsAvailable() internally. There's no need
42 // to check IsAvailable() explicitly before calling them. 43 // to check IsAvailable() explicitly before calling them.
43 static bool IsAvailable(); 44 static bool IsAvailable();
44 45
45 static bool IsSecurityLevelSupported(const std::string& key_system,
ddorwin 2015/02/18 02:19:26 Does not appear to be used except in the tests, wh
46 SecurityLevel security_level);
47
48 // Checks whether |key_system| is supported. 46 // Checks whether |key_system| is supported.
49 static bool IsKeySystemSupported(const std::string& key_system); 47 static bool IsKeySystemSupported(const std::string& key_system);
50 48
51 // Returns the list of the platform-supported key system names that 49 // Returns the list of the platform-supported key system names that
52 // are not handled by Chrome explicitly. 50 // are not handled by Chrome explicitly.
53 static std::vector<std::string> GetPlatformKeySystemNames(); 51 static std::vector<std::string> GetPlatformKeySystemNames();
54 52
55 // Checks whether |key_system| is supported with |container_mime_type|. 53 // Checks whether |key_system| is supported with |container_mime_type|.
56 // |container_mime_type| must not be empty. 54 // |container_mime_type| must not be empty.
57 static bool IsKeySystemSupportedWithType( 55 static bool IsKeySystemSupportedWithType(
58 const std::string& key_system, 56 const std::string& key_system,
59 const std::string& container_mime_type); 57 const std::string& container_mime_type);
60 58
61 static bool IsSecureDecoderRequired(SecurityLevel security_level);
62
63 static bool RegisterMediaDrmBridge(JNIEnv* env); 59 static bool RegisterMediaDrmBridge(JNIEnv* env);
64 60
65 // Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL 61 // Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL
66 // pointer otherwise. 62 // pointer otherwise.
67 // TODO(xhwang): Is it okay not to update session expiration info? 63 // TODO(xhwang): Is it okay not to update session expiration info?
68 static scoped_ptr<MediaDrmBridge> Create( 64 static scoped_ptr<MediaDrmBridge> Create(
69 const std::string& key_system, 65 const std::string& key_system,
70 const SessionMessageCB& session_message_cb, 66 const SessionMessageCB& session_message_cb,
71 const SessionClosedCB& session_closed_cb, 67 const SessionClosedCB& session_closed_cb,
72 const SessionErrorCB& session_error_cb, 68 const SessionErrorCB& session_error_cb,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // video playback. 180 // video playback.
185 bool IsProtectedSurfaceRequired(); 181 bool IsProtectedSurfaceRequired();
186 182
187 private: 183 private:
188 MediaDrmBridge(const std::vector<uint8>& scheme_uuid, 184 MediaDrmBridge(const std::vector<uint8>& scheme_uuid,
189 const SessionMessageCB& session_message_cb, 185 const SessionMessageCB& session_message_cb,
190 const SessionClosedCB& session_closed_cb, 186 const SessionClosedCB& session_closed_cb,
191 const SessionErrorCB& session_error_cb, 187 const SessionErrorCB& session_error_cb,
192 const SessionKeysChangeCB& session_keys_change_cb); 188 const SessionKeysChangeCB& session_keys_change_cb);
193 189
190 static bool IsSecureDecoderRequired(SecurityLevel security_level);
191
194 // Get the security level of the media. 192 // Get the security level of the media.
195 SecurityLevel GetSecurityLevel(); 193 SecurityLevel GetSecurityLevel();
196 194
197 // UUID of the key system. 195 // UUID of the key system.
198 std::vector<uint8> scheme_uuid_; 196 std::vector<uint8> scheme_uuid_;
199 197
200 // Java MediaDrm instance. 198 // Java MediaDrm instance.
201 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; 199 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_;
202 200
203 // Callbacks for firing session events. 201 // Callbacks for firing session events.
204 SessionMessageCB session_message_cb_; 202 SessionMessageCB session_message_cb_;
205 SessionClosedCB session_closed_cb_; 203 SessionClosedCB session_closed_cb_;
206 SessionErrorCB session_error_cb_; 204 SessionErrorCB session_error_cb_;
207 SessionKeysChangeCB session_keys_change_cb_; 205 SessionKeysChangeCB session_keys_change_cb_;
208 206
209 base::Closure media_crypto_ready_cb_; 207 base::Closure media_crypto_ready_cb_;
210 208
211 ResetCredentialsCB reset_credentials_cb_; 209 ResetCredentialsCB reset_credentials_cb_;
212 210
213 PlayerTrackerImpl player_tracker_; 211 PlayerTrackerImpl player_tracker_;
214 212
215 CdmPromiseAdapter cdm_promise_adapter_; 213 CdmPromiseAdapter cdm_promise_adapter_;
216 214
217 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); 215 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
218 }; 216 };
219 217
220 } // namespace media 218 } // namespace media
221 219
222 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 220 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698