OLD | NEW |
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 <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/android/scoped_java_ref.h" | 15 #include "base/android/scoped_java_ref.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/sequenced_task_runner_helpers.h" | 20 #include "base/sequenced_task_runner_helpers.h" |
| 21 #include "media/base/android/android_util.h" |
21 #include "media/base/android/media_drm_bridge_cdm_context.h" | 22 #include "media/base/android/media_drm_bridge_cdm_context.h" |
| 23 #include "media/base/android/media_drm_storage_bridge.h" |
22 #include "media/base/cdm_promise.h" | 24 #include "media/base/cdm_promise.h" |
23 #include "media/base/cdm_promise_adapter.h" | 25 #include "media/base/cdm_promise_adapter.h" |
24 #include "media/base/content_decryption_module.h" | 26 #include "media/base/content_decryption_module.h" |
25 #include "media/base/media_export.h" | 27 #include "media/base/media_export.h" |
26 #include "media/base/player_tracker.h" | 28 #include "media/base/player_tracker.h" |
27 #include "media/base/provision_fetcher.h" | 29 #include "media/base/provision_fetcher.h" |
28 #include "media/cdm/player_tracker_impl.h" | 30 #include "media/cdm/player_tracker_impl.h" |
29 #include "url/gurl.h" | 31 #include "url/gurl.h" |
30 | 32 |
31 namespace base { | 33 namespace base { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 const SessionKeysChangeCB& session_keys_change_cb, | 261 const SessionKeysChangeCB& session_keys_change_cb, |
260 const SessionExpirationUpdateCB& session_expiration_update_cb); | 262 const SessionExpirationUpdateCB& session_expiration_update_cb); |
261 | 263 |
262 ~MediaDrmBridge() override; | 264 ~MediaDrmBridge() override; |
263 | 265 |
264 static bool IsSecureDecoderRequired(SecurityLevel security_level); | 266 static bool IsSecureDecoderRequired(SecurityLevel security_level); |
265 | 267 |
266 // Get the security level of the media. | 268 // Get the security level of the media. |
267 SecurityLevel GetSecurityLevel(); | 269 SecurityLevel GetSecurityLevel(); |
268 | 270 |
269 // A helper method to create a JavaObjectPtr. | |
270 JavaObjectPtr CreateJavaObjectPtr(jobject object); | |
271 | |
272 // A helper method that is called when MediaCrypto is ready. | 271 // A helper method that is called when MediaCrypto is ready. |
273 void NotifyMediaCryptoReady(JavaObjectPtr j_media_crypto); | 272 void NotifyMediaCryptoReady(JavaObjectPtr j_media_crypto); |
274 | 273 |
275 // Sends HTTP provisioning request to a provisioning server. | 274 // Sends HTTP provisioning request to a provisioning server. |
276 void SendProvisioningRequest(const std::string& default_url, | 275 void SendProvisioningRequest(const std::string& default_url, |
277 const std::string& request_data); | 276 const std::string& request_data); |
278 | 277 |
279 // Process the data received by provisioning server. | 278 // Process the data received by provisioning server. |
280 void ProcessProvisionResponse(bool success, const std::string& response); | 279 void ProcessProvisionResponse(bool success, const std::string& response); |
281 | 280 |
282 // Called on the |task_runner_| when there is additional usable key. | 281 // Called on the |task_runner_| when there is additional usable key. |
283 void OnHasAdditionalUsableKey(); | 282 void OnHasAdditionalUsableKey(); |
284 | 283 |
285 // UUID of the key system. | 284 // UUID of the key system. |
286 std::vector<uint8_t> scheme_uuid_; | 285 std::vector<uint8_t> scheme_uuid_; |
287 | 286 |
| 287 // Persistent storage for session ID map. |
| 288 MediaDrmStorageBridge storage_; |
| 289 |
288 // Java MediaDrm instance. | 290 // Java MediaDrm instance. |
289 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; | 291 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; |
290 | 292 |
291 // Java MediaCrypto instance. Possible values are: | 293 // Java MediaCrypto instance. Possible values are: |
292 // !j_media_crypto_: | 294 // !j_media_crypto_: |
293 // MediaCrypto creation has not been notified via NotifyMediaCryptoReady(). | 295 // MediaCrypto creation has not been notified via NotifyMediaCryptoReady(). |
294 // !j_media_crypto_->is_null(): | 296 // !j_media_crypto_->is_null(): |
295 // MediaCrypto creation succeeded and it has been notified. | 297 // MediaCrypto creation succeeded and it has been notified. |
296 // j_media_crypto_->is_null(): | 298 // j_media_crypto_->is_null(): |
297 // MediaCrypto creation failed and it has been notified. | 299 // MediaCrypto creation failed and it has been notified. |
(...skipping 27 matching lines...) Expand all Loading... |
325 | 327 |
326 // NOTE: Weak pointers must be invalidated before all other member variables. | 328 // NOTE: Weak pointers must be invalidated before all other member variables. |
327 base::WeakPtrFactory<MediaDrmBridge> weak_factory_; | 329 base::WeakPtrFactory<MediaDrmBridge> weak_factory_; |
328 | 330 |
329 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); | 331 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); |
330 }; | 332 }; |
331 | 333 |
332 } // namespace media | 334 } // namespace media |
333 | 335 |
334 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ | 336 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ |
OLD | NEW |