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

Unified Diff: media/base/android/media_drm_bridge.h

Issue 1341883003: Prepare MediaDrmBridge to work with MediaCodecPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bug526755
Patch Set: Addressed Min's comments Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_drm_bridge.h
diff --git a/media/base/android/media_drm_bridge.h b/media/base/android/media_drm_bridge.h
index f6a951f607749a10049441595a7753b374509c4d..33f99e97ad0b9062674382b7010607eeb9d454cb 100644
--- a/media/base/android/media_drm_bridge.h
+++ b/media/base/android/media_drm_bridge.h
@@ -12,6 +12,7 @@
#include "base/android/scoped_java_ref.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "media/base/browser_cdm.h"
#include "media/base/cdm_promise_adapter.h"
#include "media/base/media_export.h"
@@ -43,6 +44,10 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
// to check IsAvailable() explicitly before calling them.
static bool IsAvailable();
+ // Checks whether we can create the DRM for key system and security level.
+ static bool CanCreate(const std::string& key_system,
+ SecurityLevel widevine_security_level);
+
// Checks whether |key_system| is supported.
static bool IsKeySystemSupported(const std::string& key_system);
@@ -61,8 +66,9 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
// Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL
// pointer otherwise.
// TODO(xhwang): Is it okay not to update session expiration info?
- static scoped_ptr<MediaDrmBridge> Create(
+ static scoped_ptr<MediaDrmBridge, BrowserCdmDeleter> Create(
const std::string& key_system,
+ SecurityLevel widevine_security_level,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const LegacySessionErrorCB& legacy_session_error_cb,
@@ -72,8 +78,8 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
// Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL
// otherwise. No session callbacks are provided. This is used when we need to
// use MediaDrmBridge without creating any sessions.
- static scoped_ptr<MediaDrmBridge> CreateWithoutSessionSupport(
- const std::string& key_system);
+ static scoped_ptr<MediaDrmBridge, BrowserCdmDeleter>
+ CreateWithoutSessionSupport(const std::string& key_system);
// Returns true if |security_level| is successfully set, or false otherwise.
// Call this function right after Create() and before any other calls.
@@ -199,6 +205,14 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
// Get the security level of the media.
SecurityLevel GetSecurityLevel();
+ void InternalKeysAdded(bool has_additional_usable_key);
+
+ void InternalPromiseResolved(uint32_t promise_id);
+ void InternalPromiseResolvedWithSession(uint32_t promise_id,
+ const std::string& session_id);
+ void InternalPromiseRejected(uint32_t promise_id,
+ const std::string& error_message);
+
// UUID of the key system.
std::vector<uint8> scheme_uuid_;
@@ -220,6 +234,21 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
CdmPromiseAdapter cdm_promise_adapter_;
+ // Callback for posting Java notifications to Media thread.
+ typedef base::Callback<void(bool)> KeysAddedCallback;
+ KeysAddedCallback internal_keys_added_cb_;
+
+ typedef base::Callback<void(uint32_t)> PromiseCallback;
+ typedef base::Callback<void(uint32_t, const std::string&)> PromiseWSCallback;
+ PromiseCallback internal_promise_resolved_cb_;
+ PromiseWSCallback internal_promise_resolved_with_session_cb_;
+ PromiseWSCallback internal_promise_rejected_cb_;
+
+ bool run_on_media_thread_;
+
+ // NOTE: Weak pointers must be invalidated before all other member variables.
+ base::WeakPtrFactory<MediaDrmBridge> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
};

Powered by Google App Engine
This is Rietveld 408576698