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

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: Cleanup 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..29765ba08cafd73cbc156a8e05cdd7ea8723f954 100644
--- a/media/base/android/media_drm_bridge.h
+++ b/media/base/android/media_drm_bridge.h
@@ -12,6 +12,8 @@
#include "base/android/scoped_java_ref.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/synchronization/lock.h"
#include "media/base/browser_cdm.h"
#include "media/base/cdm_promise_adapter.h"
#include "media/base/media_export.h"
@@ -38,6 +40,8 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
~MediaDrmBridge() override;
+ void DeleteOnCorrectThread() override;
+
// Checks whether MediaDRM is available.
// All other static methods check IsAvailable() internally. There's no need
// to check IsAvailable() explicitly before calling them.
@@ -61,7 +65,7 @@ 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,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
@@ -72,8 +76,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 +203,8 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
// Get the security level of the media.
SecurityLevel GetSecurityLevel();
+ void InternalKeysAdded(bool has_additional_usable_key);
+
// UUID of the key system.
std::vector<uint8> scheme_uuid_;
@@ -220,6 +226,22 @@ 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_;
+
+ // This flag is set when we use media thread for certain callbacks.
+ bool use_media_thread_;
+
+ // A flag with the lock to prevent GetMediaCrypto() calls
+ // after we started destruction. Maybe it's possible to pass
+ // MediaCrypto with a callback and avoid this.
+ bool destruction_started_;
+ base::Lock destruction_started_lock_;
+
+ // 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