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

Side by Side Diff: content/renderer/media/crypto/ppapi_decryptor.h

Issue 555223004: Update MediaKeys interface for EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 6 years, 2 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 unified diff | Download patch
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 CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_
6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 // This class should always be created & destroyed on the main renderer thread. 31 // This class should always be created & destroyed on the main renderer thread.
32 class PpapiDecryptor : public media::MediaKeys, public media::Decryptor { 32 class PpapiDecryptor : public media::MediaKeys, public media::Decryptor {
33 public: 33 public:
34 static scoped_ptr<PpapiDecryptor> Create( 34 static scoped_ptr<PpapiDecryptor> Create(
35 const std::string& key_system, 35 const std::string& key_system,
36 const GURL& security_origin, 36 const GURL& security_origin,
37 const CreatePepperCdmCB& create_pepper_cdm_cb, 37 const CreatePepperCdmCB& create_pepper_cdm_cb,
38 const media::SessionMessageCB& session_message_cb, 38 const media::SessionMessageCB& session_message_cb,
39 const media::SessionReadyCB& session_ready_cb, 39 const media::SessionReadyCB& session_ready_cb,
40 const media::SessionClosedCB& session_closed_cb, 40 const media::SessionClosedCB& session_closed_cb,
41 const media::SessionErrorCB& session_error_cb); 41 const media::SessionErrorCB& session_error_cb,
42 const media::SessionKeysChangeCB& session_keys_change_cb,
43 const media::SessionExpirationUpdateCB& session_expiration_update_cb);
42 44
43 virtual ~PpapiDecryptor(); 45 virtual ~PpapiDecryptor();
44 46
45 // media::MediaKeys implementation. 47 // media::MediaKeys implementation.
48 virtual void SetServerCertificate(
49 const uint8* certificate_data,
50 int certificate_data_length,
51 scoped_ptr<media::SimpleCdmPromise> promise) OVERRIDE;
46 virtual void CreateSession( 52 virtual void CreateSession(
47 const std::string& init_data_type, 53 const std::string& init_data_type,
48 const uint8* init_data, 54 const uint8* init_data,
49 int init_data_length, 55 int init_data_length,
50 SessionType session_type, 56 SessionType session_type,
51 scoped_ptr<media::NewSessionCdmPromise> promise) OVERRIDE; 57 scoped_ptr<media::NewSessionCdmPromise> promise) OVERRIDE;
52 virtual void LoadSession( 58 virtual void LoadSession(
53 const std::string& web_session_id, 59 const std::string& web_session_id,
54 scoped_ptr<media::NewSessionCdmPromise> promise) OVERRIDE; 60 scoped_ptr<media::NewSessionCdmPromise> promise) OVERRIDE;
55 virtual void UpdateSession( 61 virtual void UpdateSession(
56 const std::string& web_session_id, 62 const std::string& web_session_id,
57 const uint8* response, 63 const uint8* response,
58 int response_length, 64 int response_length,
59 scoped_ptr<media::SimpleCdmPromise> promise) OVERRIDE; 65 scoped_ptr<media::SimpleCdmPromise> promise) OVERRIDE;
60 virtual void ReleaseSession( 66 virtual void CloseSession(
61 const std::string& web_session_id, 67 const std::string& web_session_id,
62 scoped_ptr<media::SimpleCdmPromise> promise) OVERRIDE; 68 scoped_ptr<media::SimpleCdmPromise> promise) OVERRIDE;
69 virtual void RemoveSession(
70 const std::string& web_session_id,
71 scoped_ptr<media::SimpleCdmPromise> promise) OVERRIDE;
72 virtual void GetUsableKeyIds(
73 const std::string& web_session_id,
74 scoped_ptr<media::KeyIdsPromise> promise) OVERRIDE;
63 virtual Decryptor* GetDecryptor() OVERRIDE; 75 virtual Decryptor* GetDecryptor() OVERRIDE;
64 76
65 // media::Decryptor implementation. 77 // media::Decryptor implementation.
66 virtual void RegisterNewKeyCB(StreamType stream_type, 78 virtual void RegisterNewKeyCB(StreamType stream_type,
67 const NewKeyCB& key_added_cb) OVERRIDE; 79 const NewKeyCB& key_added_cb) OVERRIDE;
68 virtual void Decrypt(StreamType stream_type, 80 virtual void Decrypt(StreamType stream_type,
69 const scoped_refptr<media::DecoderBuffer>& encrypted, 81 const scoped_refptr<media::DecoderBuffer>& encrypted,
70 const DecryptCB& decrypt_cb) OVERRIDE; 82 const DecryptCB& decrypt_cb) OVERRIDE;
71 virtual void CancelDecrypt(StreamType stream_type) OVERRIDE; 83 virtual void CancelDecrypt(StreamType stream_type) OVERRIDE;
72 virtual void InitializeAudioDecoder(const media::AudioDecoderConfig& config, 84 virtual void InitializeAudioDecoder(const media::AudioDecoderConfig& config,
73 const DecoderInitCB& init_cb) OVERRIDE; 85 const DecoderInitCB& init_cb) OVERRIDE;
74 virtual void InitializeVideoDecoder(const media::VideoDecoderConfig& config, 86 virtual void InitializeVideoDecoder(const media::VideoDecoderConfig& config,
75 const DecoderInitCB& init_cb) OVERRIDE; 87 const DecoderInitCB& init_cb) OVERRIDE;
76 virtual void DecryptAndDecodeAudio( 88 virtual void DecryptAndDecodeAudio(
77 const scoped_refptr<media::DecoderBuffer>& encrypted, 89 const scoped_refptr<media::DecoderBuffer>& encrypted,
78 const AudioDecodeCB& audio_decode_cb) OVERRIDE; 90 const AudioDecodeCB& audio_decode_cb) OVERRIDE;
79 virtual void DecryptAndDecodeVideo( 91 virtual void DecryptAndDecodeVideo(
80 const scoped_refptr<media::DecoderBuffer>& encrypted, 92 const scoped_refptr<media::DecoderBuffer>& encrypted,
81 const VideoDecodeCB& video_decode_cb) OVERRIDE; 93 const VideoDecodeCB& video_decode_cb) OVERRIDE;
82 virtual void ResetDecoder(StreamType stream_type) OVERRIDE; 94 virtual void ResetDecoder(StreamType stream_type) OVERRIDE;
83 virtual void DeinitializeDecoder(StreamType stream_type) OVERRIDE; 95 virtual void DeinitializeDecoder(StreamType stream_type) OVERRIDE;
84 96
85 private: 97 private:
86 PpapiDecryptor(const std::string& key_system, 98 PpapiDecryptor(
87 scoped_ptr<PepperCdmWrapper> pepper_cdm_wrapper, 99 const std::string& key_system,
88 const media::SessionMessageCB& session_message_cb, 100 scoped_ptr<PepperCdmWrapper> pepper_cdm_wrapper,
89 const media::SessionReadyCB& session_ready_cb, 101 const media::SessionMessageCB& session_message_cb,
90 const media::SessionClosedCB& session_closed_cb, 102 const media::SessionReadyCB& session_ready_cb,
91 const media::SessionErrorCB& session_error_cb); 103 const media::SessionClosedCB& session_closed_cb,
104 const media::SessionErrorCB& session_error_cb,
105 const media::SessionKeysChangeCB& session_keys_change_cb,
106 const media::SessionExpirationUpdateCB& session_expiration_update_cb);
92 107
93 void OnDecoderInitialized(StreamType stream_type, bool success); 108 void OnDecoderInitialized(StreamType stream_type, bool success);
94 109
95 // Callbacks for |plugin_cdm_delegate_| to fire session events. 110 // Callbacks for |plugin_cdm_delegate_| to fire session events.
96 void OnSessionMessage(const std::string& web_session_id, 111 void OnSessionMessage(const std::string& web_session_id,
97 const std::vector<uint8>& message, 112 const std::vector<uint8>& message,
98 const GURL& destination_url); 113 const GURL& destination_url);
114 void OnSessionKeysChange(const std::string& web_session_id,
115 bool has_additional_usable_key);
116 void OnSessionExpirationUpdate(const std::string& web_session_id,
117 const base::Time& new_expiry_time);
99 void OnSessionReady(const std::string& web_session_id); 118 void OnSessionReady(const std::string& web_session_id);
100 void OnSessionClosed(const std::string& web_session_id); 119 void OnSessionClosed(const std::string& web_session_id);
101 void OnSessionError(const std::string& web_session_id, 120 void OnSessionError(const std::string& web_session_id,
102 MediaKeys::Exception exception_code, 121 MediaKeys::Exception exception_code,
103 uint32 system_code, 122 uint32 system_code,
104 const std::string& error_description); 123 const std::string& error_description);
105 124
106 // On a successful Update() or SessionReady event, trigger playback to resume. 125 // On a successful Update() or SessionReady event, trigger playback to resume.
107 void ResumePlayback(); 126 void ResumePlayback();
108 127
109 // Callback to notify that a fatal error happened in |plugin_cdm_delegate_|. 128 // Callback to notify that a fatal error happened in |plugin_cdm_delegate_|.
110 // The error is terminal and |plugin_cdm_delegate_| should not be used after 129 // The error is terminal and |plugin_cdm_delegate_| should not be used after
111 // this call. 130 // this call.
112 void OnFatalPluginError(); 131 void OnFatalPluginError();
113 132
114 ContentDecryptorDelegate* CdmDelegate(); 133 ContentDecryptorDelegate* CdmDelegate();
115 134
116 // Hold a reference of the Pepper CDM wrapper to make sure the plugin lives 135 // Hold a reference of the Pepper CDM wrapper to make sure the plugin lives
117 // as long as needed. 136 // as long as needed.
118 scoped_ptr<PepperCdmWrapper> pepper_cdm_wrapper_; 137 scoped_ptr<PepperCdmWrapper> pepper_cdm_wrapper_;
119 138
120 // Callbacks for firing session events. 139 // Callbacks for firing session events.
121 media::SessionMessageCB session_message_cb_; 140 media::SessionMessageCB session_message_cb_;
122 media::SessionReadyCB session_ready_cb_; 141 media::SessionReadyCB session_ready_cb_;
123 media::SessionClosedCB session_closed_cb_; 142 media::SessionClosedCB session_closed_cb_;
124 media::SessionErrorCB session_error_cb_; 143 media::SessionErrorCB session_error_cb_;
144 media::SessionKeysChangeCB session_keys_change_cb_;
145 media::SessionExpirationUpdateCB session_expiration_update_cb_;
125 146
126 scoped_refptr<base::MessageLoopProxy> render_loop_proxy_; 147 scoped_refptr<base::MessageLoopProxy> render_loop_proxy_;
127 148
128 DecoderInitCB audio_decoder_init_cb_; 149 DecoderInitCB audio_decoder_init_cb_;
129 DecoderInitCB video_decoder_init_cb_; 150 DecoderInitCB video_decoder_init_cb_;
130 NewKeyCB new_audio_key_cb_; 151 NewKeyCB new_audio_key_cb_;
131 NewKeyCB new_video_key_cb_; 152 NewKeyCB new_video_key_cb_;
132 153
133 // NOTE: Weak pointers must be invalidated before all other member variables. 154 // NOTE: Weak pointers must be invalidated before all other member variables.
134 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; 155 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_;
135 156
136 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); 157 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor);
137 }; 158 };
138 159
139 } // namespace content 160 } // namespace content
140 161
141 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ 162 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_
OLDNEW
« no previous file with comments | « content/renderer/media/crypto/content_decryption_module_factory.cc ('k') | content/renderer/media/crypto/ppapi_decryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698