OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_CDM_CONTEXT_H_ | |
6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_CDM_CONTEXT_H_ | |
7 | |
8 #include <jni.h> | |
9 | |
10 #include "base/android/scoped_java_ref.h" | |
11 #include "base/callback.h" | |
12 #include "base/macros.h" | |
13 #include "media/base/cdm_context.h" | |
14 #include "media/base/media_export.h" | |
15 #include "media/base/player_tracker.h" | |
16 | |
17 namespace media { | |
18 | |
19 class MediaDrmBridge; | |
20 | |
21 // Methods can be called on any thread. The registered callbacks will be fired | |
ddorwin
2016/03/18 18:27:14
Describe the purpose of this class.
Specifically,
xhwang
2016/03/18 22:10:46
I updated the CdmContext documentation to make thi
| |
22 // on the thread |media_drm_bridge_| is running on. The caller should make sure | |
23 // that the callbacks are posted to the correct thread. | |
24 // TODO(xhwang): Remove PlayerTracker interface. | |
25 class MEDIA_EXPORT MediaDrmBridgeCdmContext : public CdmContext, | |
26 public PlayerTracker { | |
27 public: | |
28 using JavaObjectPtr = scoped_ptr<base::android::ScopedJavaGlobalRef<jobject>>; | |
29 | |
30 // Notification called when MediaCrypto object is ready. | |
31 // Parameters: | |
32 // |media_crypto| - global reference to MediaCrypto object | |
ddorwin
2016/03/18 18:27:14
What does global reference mean?
xhwang
2016/03/18 22:10:46
I think this is because the JavaObjectPtr is a Sco
| |
33 // |needs_protected_surface| - true if protected surface is required. | |
34 using MediaCryptoReadyCB = base::Callback<void(JavaObjectPtr media_crypto, | |
35 bool needs_protected_surface)>; | |
36 | |
37 // The |media_drm_bridge| owns |this| is guaranteed to outlive |this|. | |
ddorwin
2016/03/18 18:27:14
There seems to be a word missing. Perhaps either "
xhwang
2016/03/18 22:10:46
Done.
| |
38 explicit MediaDrmBridgeCdmContext(MediaDrmBridge* media_drm_bridge); | |
39 | |
40 ~MediaDrmBridgeCdmContext() final; | |
41 | |
42 // CdmContext implementation. | |
43 Decryptor* GetDecryptor() final; | |
44 int GetCdmId() const final; | |
45 | |
46 // PlayerTracker implementation. Can be called on any thread. | |
ddorwin
2016/03/18 18:27:14
Nit: newline after the first sentence. Such lines
xhwang
2016/03/18 22:10:46
Done.
| |
47 // The registered callbacks will be fired on |task_runner_|. The caller | |
48 // should make sure that the callbacks are posted to the correct thread. | |
49 // | |
50 // Note: RegisterPlayer() should be called before SetMediaCryptoReadyCB() to | |
ddorwin
2016/03/18 18:27:14
s/should/must/?
xhwang
2016/03/18 22:10:46
Done.
| |
51 // avoid missing any new key notifications. | |
52 int RegisterPlayer(const base::Closure& new_key_cb, | |
53 const base::Closure& cdm_unset_cb) final; | |
54 void UnregisterPlayer(int registration_id) final; | |
55 | |
56 void SetMediaCryptoReadyCB(const MediaCryptoReadyCB& media_crypto_ready_cb); | |
57 | |
58 private: | |
59 MediaDrmBridge* const media_drm_bridge_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridgeCdmContext); | |
62 }; | |
63 | |
64 } // namespace media | |
65 | |
66 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_CDM_CONTEXT_H_ | |
OLD | NEW |