| OLD | NEW |
| 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_CDM_PPAPI_DECRYPTOR_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ | 6 #define CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 public media::Decryptor { | 38 public media::Decryptor { |
| 39 public: | 39 public: |
| 40 static void Create( | 40 static void Create( |
| 41 const std::string& key_system, | 41 const std::string& key_system, |
| 42 const GURL& security_origin, | 42 const GURL& security_origin, |
| 43 bool allow_distinctive_identifier, | 43 bool allow_distinctive_identifier, |
| 44 bool allow_persistent_state, | 44 bool allow_persistent_state, |
| 45 const CreatePepperCdmCB& create_pepper_cdm_cb, | 45 const CreatePepperCdmCB& create_pepper_cdm_cb, |
| 46 const media::SessionMessageCB& session_message_cb, | 46 const media::SessionMessageCB& session_message_cb, |
| 47 const media::SessionClosedCB& session_closed_cb, | 47 const media::SessionClosedCB& session_closed_cb, |
| 48 const media::LegacySessionErrorCB& legacy_session_error_cb, | |
| 49 const media::SessionKeysChangeCB& session_keys_change_cb, | 48 const media::SessionKeysChangeCB& session_keys_change_cb, |
| 50 const media::SessionExpirationUpdateCB& session_expiration_update_cb, | 49 const media::SessionExpirationUpdateCB& session_expiration_update_cb, |
| 51 const media::CdmCreatedCB& cdm_created_cb); | 50 const media::CdmCreatedCB& cdm_created_cb); |
| 52 | 51 |
| 53 // media::MediaKeys implementation. | 52 // media::MediaKeys implementation. |
| 54 void SetServerCertificate( | 53 void SetServerCertificate( |
| 55 const std::vector<uint8_t>& certificate, | 54 const std::vector<uint8_t>& certificate, |
| 56 std::unique_ptr<media::SimpleCdmPromise> promise) override; | 55 std::unique_ptr<media::SimpleCdmPromise> promise) override; |
| 57 void CreateSessionAndGenerateRequest( | 56 void CreateSessionAndGenerateRequest( |
| 58 SessionType session_type, | 57 SessionType session_type, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const scoped_refptr<media::DecoderBuffer>& encrypted, | 93 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 95 const VideoDecodeCB& video_decode_cb) override; | 94 const VideoDecodeCB& video_decode_cb) override; |
| 96 void ResetDecoder(StreamType stream_type) override; | 95 void ResetDecoder(StreamType stream_type) override; |
| 97 void DeinitializeDecoder(StreamType stream_type) override; | 96 void DeinitializeDecoder(StreamType stream_type) override; |
| 98 | 97 |
| 99 private: | 98 private: |
| 100 PpapiDecryptor( | 99 PpapiDecryptor( |
| 101 std::unique_ptr<PepperCdmWrapper> pepper_cdm_wrapper, | 100 std::unique_ptr<PepperCdmWrapper> pepper_cdm_wrapper, |
| 102 const media::SessionMessageCB& session_message_cb, | 101 const media::SessionMessageCB& session_message_cb, |
| 103 const media::SessionClosedCB& session_closed_cb, | 102 const media::SessionClosedCB& session_closed_cb, |
| 104 const media::LegacySessionErrorCB& legacy_session_error_cb, | |
| 105 const media::SessionKeysChangeCB& session_keys_change_cb, | 103 const media::SessionKeysChangeCB& session_keys_change_cb, |
| 106 const media::SessionExpirationUpdateCB& session_expiration_update_cb); | 104 const media::SessionExpirationUpdateCB& session_expiration_update_cb); |
| 107 | 105 |
| 108 ~PpapiDecryptor() override; | 106 ~PpapiDecryptor() override; |
| 109 | 107 |
| 110 void InitializeCdm(const std::string& key_system, | 108 void InitializeCdm(const std::string& key_system, |
| 111 bool allow_distinctive_identifier, | 109 bool allow_distinctive_identifier, |
| 112 bool allow_persistent_state, | 110 bool allow_persistent_state, |
| 113 std::unique_ptr<media::SimpleCdmPromise> promise); | 111 std::unique_ptr<media::SimpleCdmPromise> promise); |
| 114 | 112 |
| 115 void OnDecoderInitialized(StreamType stream_type, bool success); | 113 void OnDecoderInitialized(StreamType stream_type, bool success); |
| 116 | 114 |
| 117 // Callbacks for |plugin_cdm_delegate_| to fire session events. | 115 // Callbacks for |plugin_cdm_delegate_| to fire session events. |
| 118 void OnSessionMessage(const std::string& session_id, | 116 void OnSessionMessage(const std::string& session_id, |
| 119 MediaKeys::MessageType message_type, | 117 MediaKeys::MessageType message_type, |
| 120 const std::vector<uint8_t>& message, | 118 const std::vector<uint8_t>& message); |
| 121 const GURL& legacy_destination_url); | |
| 122 void OnSessionKeysChange(const std::string& session_id, | 119 void OnSessionKeysChange(const std::string& session_id, |
| 123 bool has_additional_usable_key, | 120 bool has_additional_usable_key, |
| 124 media::CdmKeysInfo keys_info); | 121 media::CdmKeysInfo keys_info); |
| 125 void OnSessionExpirationUpdate(const std::string& session_id, | 122 void OnSessionExpirationUpdate(const std::string& session_id, |
| 126 const base::Time& new_expiry_time); | 123 const base::Time& new_expiry_time); |
| 127 void OnSessionClosed(const std::string& session_id); | 124 void OnSessionClosed(const std::string& session_id); |
| 128 void OnLegacySessionError(const std::string& session_id, | |
| 129 MediaKeys::Exception exception_code, | |
| 130 uint32_t system_code, | |
| 131 const std::string& error_description); | |
| 132 | 125 |
| 133 void AttemptToResumePlayback(); | 126 void AttemptToResumePlayback(); |
| 134 | 127 |
| 135 // 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_|. |
| 136 // 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 |
| 137 // this call. | 130 // this call. |
| 138 void OnFatalPluginError(); | 131 void OnFatalPluginError(); |
| 139 | 132 |
| 140 ContentDecryptorDelegate* CdmDelegate(); | 133 ContentDecryptorDelegate* CdmDelegate(); |
| 141 | 134 |
| 142 // 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 |
| 143 // as long as needed. | 136 // as long as needed. |
| 144 std::unique_ptr<PepperCdmWrapper> pepper_cdm_wrapper_; | 137 std::unique_ptr<PepperCdmWrapper> pepper_cdm_wrapper_; |
| 145 | 138 |
| 146 // Callbacks for firing session events. | 139 // Callbacks for firing session events. |
| 147 media::SessionMessageCB session_message_cb_; | 140 media::SessionMessageCB session_message_cb_; |
| 148 media::SessionClosedCB session_closed_cb_; | 141 media::SessionClosedCB session_closed_cb_; |
| 149 media::LegacySessionErrorCB legacy_session_error_cb_; | |
| 150 media::SessionKeysChangeCB session_keys_change_cb_; | 142 media::SessionKeysChangeCB session_keys_change_cb_; |
| 151 media::SessionExpirationUpdateCB session_expiration_update_cb_; | 143 media::SessionExpirationUpdateCB session_expiration_update_cb_; |
| 152 | 144 |
| 153 scoped_refptr<base::SingleThreadTaskRunner> render_task_runner_; | 145 scoped_refptr<base::SingleThreadTaskRunner> render_task_runner_; |
| 154 | 146 |
| 155 DecoderInitCB audio_decoder_init_cb_; | 147 DecoderInitCB audio_decoder_init_cb_; |
| 156 DecoderInitCB video_decoder_init_cb_; | 148 DecoderInitCB video_decoder_init_cb_; |
| 157 NewKeyCB new_audio_key_cb_; | 149 NewKeyCB new_audio_key_cb_; |
| 158 NewKeyCB new_video_key_cb_; | 150 NewKeyCB new_video_key_cb_; |
| 159 | 151 |
| 160 // NOTE: Weak pointers must be invalidated before all other member variables. | 152 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 161 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; | 153 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; |
| 162 | 154 |
| 163 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); | 155 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); |
| 164 }; | 156 }; |
| 165 | 157 |
| 166 } // namespace content | 158 } // namespace content |
| 167 | 159 |
| 168 #endif // CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ | 160 #endif // CONTENT_RENDERER_MEDIA_CDM_PPAPI_DECRYPTOR_H_ |
| OLD | NEW |