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

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

Issue 105383002: Rename EME WD call parameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nit Created 7 years 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 <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const std::string& security_level); 54 const std::string& security_level);
55 55
56 static bool IsCryptoSchemeSupported(const std::vector<uint8>& scheme_uuid, 56 static bool IsCryptoSchemeSupported(const std::vector<uint8>& scheme_uuid,
57 const std::string& container_mime_type); 57 const std::string& container_mime_type);
58 58
59 static bool IsSecureDecoderRequired(const std::string& security_level_str); 59 static bool IsSecureDecoderRequired(const std::string& security_level_str);
60 60
61 static bool RegisterMediaDrmBridge(JNIEnv* env); 61 static bool RegisterMediaDrmBridge(JNIEnv* env);
62 62
63 // MediaKeys implementations. 63 // MediaKeys implementations.
64 virtual bool CreateSession(uint32 reference_id, 64 virtual bool CreateSession(uint32 session_id,
65 const std::string& type, 65 const std::string& type,
66 const uint8* init_data, 66 const uint8* init_data,
67 int init_data_length) OVERRIDE; 67 int init_data_length) OVERRIDE;
68 virtual void UpdateSession(uint32 reference_id, 68 virtual void UpdateSession(uint32 session_id,
69 const uint8* response, 69 const uint8* response,
70 int response_length) OVERRIDE; 70 int response_length) OVERRIDE;
71 virtual void ReleaseSession(uint32 reference_id) OVERRIDE; 71 virtual void ReleaseSession(uint32 session_id) OVERRIDE;
72 72
73 // Returns a MediaCrypto object if it's already created. Returns a null object 73 // Returns a MediaCrypto object if it's already created. Returns a null object
74 // otherwise. 74 // otherwise.
75 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); 75 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto();
76 76
77 // Sets callback which will be called when MediaCrypto is ready. 77 // Sets callback which will be called when MediaCrypto is ready.
78 // If |closure| is null, previously set callback will be cleared. 78 // If |closure| is null, previously set callback will be cleared.
79 void SetMediaCryptoReadyCB(const base::Closure& closure); 79 void SetMediaCryptoReadyCB(const base::Closure& closure);
80 80
81 // Called after a MediaCrypto object is created. 81 // Called after a MediaCrypto object is created.
(...skipping 17 matching lines...) Expand all
99 99
100 // Helper function to determine whether a protected surface is needed for the 100 // Helper function to determine whether a protected surface is needed for the
101 // video playback. 101 // video playback.
102 bool IsProtectedSurfaceRequired(); 102 bool IsProtectedSurfaceRequired();
103 103
104 int media_keys_id() const { return media_keys_id_; } 104 int media_keys_id() const { return media_keys_id_; }
105 105
106 GURL frame_url() const { return frame_url_; } 106 GURL frame_url() const { return frame_url_; }
107 107
108 private: 108 private:
109 // Map between session_id and reference_id. 109 // Map between session_id and web_session_id.
110 typedef std::map<uint32_t, std::string> SessionMap; 110 typedef std::map<uint32_t, std::string> SessionMap;
111 111
112 static bool IsSecureDecoderRequired(SecurityLevel security_level); 112 static bool IsSecureDecoderRequired(SecurityLevel security_level);
113 113
114 MediaDrmBridge(int media_keys_id, 114 MediaDrmBridge(int media_keys_id,
115 const std::vector<uint8>& scheme_uuid, 115 const std::vector<uint8>& scheme_uuid,
116 const GURL& frame_url, 116 const GURL& frame_url,
117 const std::string& security_level, 117 const std::string& security_level,
118 MediaPlayerManager* manager); 118 MediaPlayerManager* manager);
119 119
120 // Get the security level of the media. 120 // Get the security level of the media.
121 SecurityLevel GetSecurityLevel(); 121 SecurityLevel GetSecurityLevel();
122 122
123 // Determine the corresponding reference_id for |session_id|. 123 // Determine the corresponding session_id for |web_session_id|.
124 uint32_t DetermineReferenceId(const std::string& session_id); 124 uint32_t LookupSessionId(const std::string& web_session_id);
125 125
126 // Determine the corresponding session_id for |reference_id|. The returned 126 // Determine the corresponding web_session_id for |session_id|. The returned
127 // value is only valid on the main thread, and should be stored by copy. 127 // value is only valid on the main thread, and should be stored by copy.
128 const std::string& LookupSessionId(uint32_t reference_id); 128 const std::string& LookupWebSessionId(uint32_t session_id);
129 129
130 // ID of the MediaKeys object. 130 // ID of the MediaKeys object.
131 int media_keys_id_; 131 int media_keys_id_;
132 132
133 // UUID of the key system. 133 // UUID of the key system.
134 std::vector<uint8> scheme_uuid_; 134 std::vector<uint8> scheme_uuid_;
135 135
136 // media stream's frame URL. 136 // media stream's frame URL.
137 const GURL frame_url_; 137 const GURL frame_url_;
138 138
139 // Java MediaDrm instance. 139 // Java MediaDrm instance.
140 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; 140 base::android::ScopedJavaGlobalRef<jobject> j_media_drm_;
141 141
142 // Non-owned pointer. 142 // Non-owned pointer.
143 MediaPlayerManager* manager_; 143 MediaPlayerManager* manager_;
144 144
145 base::Closure media_crypto_ready_cb_; 145 base::Closure media_crypto_ready_cb_;
146 146
147 ResetCredentialsCB reset_credentials_cb_; 147 ResetCredentialsCB reset_credentials_cb_;
148 148
149 SessionMap session_map_; 149 SessionMap session_map_;
150 150
151 // As the response from GenerateKeyRequest() will be asynchronous, add this 151 // As the response from GenerateKeyRequest() will be asynchronous, add this
152 // request to a queue and assume that the subsequent responses come back in 152 // request to a queue and assume that the subsequent responses come back in
153 // the order issued. 153 // the order issued.
154 // TODO(jrummell): Remove once the Java interface supports reference_id. 154 // TODO(jrummell): Remove once the Java interface supports session_id.
155 std::queue<uint32_t> pending_key_request_reference_ids_; 155 std::queue<uint32_t> pending_key_request_session_ids_;
156 156
157 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); 157 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge);
158 }; 158 };
159 159
160 } // namespace media 160 } // namespace media
161 161
162 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_ 162 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.cc ('k') | media/base/android/media_drm_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698