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

Side by Side Diff: media/cdm/aes_decryptor.h

Issue 1407933010: media: Make MediaKeys ref-counted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 1 month 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
« no previous file with comments | « media/blink/cdm_session_adapter.cc ('k') | media/cdm/aes_decryptor_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_CRYPTO_AES_DECRYPTOR_H_ 5 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_
6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_ 6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 19 matching lines...) Expand all
30 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES 30 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES
31 // encryption must be CTR with a key size of 128bits. 31 // encryption must be CTR with a key size of 128bits.
32 class MEDIA_EXPORT AesDecryptor : public MediaKeys, 32 class MEDIA_EXPORT AesDecryptor : public MediaKeys,
33 public CdmContext, 33 public CdmContext,
34 public Decryptor { 34 public Decryptor {
35 public: 35 public:
36 AesDecryptor(const GURL& security_origin, 36 AesDecryptor(const GURL& security_origin,
37 const SessionMessageCB& session_message_cb, 37 const SessionMessageCB& session_message_cb,
38 const SessionClosedCB& session_closed_cb, 38 const SessionClosedCB& session_closed_cb,
39 const SessionKeysChangeCB& session_keys_change_cb); 39 const SessionKeysChangeCB& session_keys_change_cb);
40 ~AesDecryptor() override;
41 40
42 // MediaKeys implementation. 41 // MediaKeys implementation.
43 void SetServerCertificate(const std::vector<uint8_t>& certificate, 42 void SetServerCertificate(const std::vector<uint8_t>& certificate,
44 scoped_ptr<SimpleCdmPromise> promise) override; 43 scoped_ptr<SimpleCdmPromise> promise) override;
45 void CreateSessionAndGenerateRequest( 44 void CreateSessionAndGenerateRequest(
46 SessionType session_type, 45 SessionType session_type,
47 EmeInitDataType init_data_type, 46 EmeInitDataType init_data_type,
48 const std::vector<uint8_t>& init_data, 47 const std::vector<uint8_t>& init_data,
49 scoped_ptr<NewSessionCdmPromise> promise) override; 48 scoped_ptr<NewSessionCdmPromise> promise) override;
50 void LoadSession(SessionType session_type, 49 void LoadSession(SessionType session_type,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // for the same key ID, then the last key inserted is used. The structure is 108 // for the same key ID, then the last key inserted is used. The structure is
110 // optimized so that Decrypt() has fast access, at the cost of slow deletion 109 // optimized so that Decrypt() has fast access, at the cost of slow deletion
111 // of keys when a session is released. 110 // of keys when a session is released.
112 class SessionIdDecryptionKeyMap; 111 class SessionIdDecryptionKeyMap;
113 112
114 // Key ID <-> SessionIdDecryptionKeyMap map. 113 // Key ID <-> SessionIdDecryptionKeyMap map.
115 typedef base::ScopedPtrHashMap<std::string, 114 typedef base::ScopedPtrHashMap<std::string,
116 scoped_ptr<SessionIdDecryptionKeyMap>> 115 scoped_ptr<SessionIdDecryptionKeyMap>>
117 KeyIdToSessionKeysMap; 116 KeyIdToSessionKeysMap;
118 117
118 ~AesDecryptor() override;
119
119 // Creates a DecryptionKey using |key_string| and associates it with |key_id|. 120 // Creates a DecryptionKey using |key_string| and associates it with |key_id|.
120 // Returns true if successful. 121 // Returns true if successful.
121 bool AddDecryptionKey(const std::string& session_id, 122 bool AddDecryptionKey(const std::string& session_id,
122 const std::string& key_id, 123 const std::string& key_id,
123 const std::string& key_string); 124 const std::string& key_string);
124 125
125 // Gets a DecryptionKey associated with |key_id|. The AesDecryptor still owns 126 // Gets a DecryptionKey associated with |key_id|. The AesDecryptor still owns
126 // the key. Returns NULL if no key is associated with |key_id|. 127 // the key. Returns NULL if no key is associated with |key_id|.
127 DecryptionKey* GetKey_Locked(const std::string& key_id) const; 128 DecryptionKey* GetKey_Locked(const std::string& key_id) const;
128 129
(...skipping 27 matching lines...) Expand all
156 // Protect |new_audio_key_cb_| and |new_video_key_cb_| as they are set on the 157 // Protect |new_audio_key_cb_| and |new_video_key_cb_| as they are set on the
157 // main thread but called on the media thread. 158 // main thread but called on the media thread.
158 mutable base::Lock new_key_cb_lock_; 159 mutable base::Lock new_key_cb_lock_;
159 160
160 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); 161 DISALLOW_COPY_AND_ASSIGN(AesDecryptor);
161 }; 162 };
162 163
163 } // namespace media 164 } // namespace media
164 165
165 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ 166 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_
OLDNEW
« no previous file with comments | « media/blink/cdm_session_adapter.cc ('k') | media/cdm/aes_decryptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698