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 MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ | 5 #ifndef MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ |
6 #define MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ | 6 #define MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 const char* challenge, uint32_t challenge_length) OVERRIDE; | 99 const char* challenge, uint32_t challenge_length) OVERRIDE; |
100 virtual void EnableOutputProtection( | 100 virtual void EnableOutputProtection( |
101 uint32_t desired_protection_mask) OVERRIDE; | 101 uint32_t desired_protection_mask) OVERRIDE; |
102 virtual void QueryOutputProtectionStatus() OVERRIDE; | 102 virtual void QueryOutputProtectionStatus() OVERRIDE; |
103 virtual void OnDeferredInitializationDone( | 103 virtual void OnDeferredInitializationDone( |
104 cdm::StreamType stream_type, | 104 cdm::StreamType stream_type, |
105 cdm::Status decoder_status) OVERRIDE; | 105 cdm::Status decoder_status) OVERRIDE; |
106 virtual cdm::FileIO* CreateFileIO(cdm::FileIOClient* client) OVERRIDE; | 106 virtual cdm::FileIO* CreateFileIO(cdm::FileIOClient* client) OVERRIDE; |
107 | 107 |
108 private: | 108 private: |
109 // These are reported to UMA server. Do not change the existing values! | |
ddorwin
2014/04/30 19:49:03
Should you hard-code the values to make it harder
xhwang
2014/04/30 21:55:29
Done.
| |
110 enum OutputProtectionStatus { | |
111 OUTPUT_PROTECTION_QUERIED, | |
112 OUTPUT_PROTECTION_QUERY_ERROR, | |
113 OUTPUT_PROTECTION_NO_EXTERNAL_LINK, | |
114 OUTPUT_PROTECTION_EXTERNAL_LINK_PROTECTED, | |
ddorwin
2014/04/30 19:49:03
ALL_...LINKS_...?
xhwang
2014/04/30 21:55:29
Done.
| |
115 OUTPUT_PROTECTION_EXTERNAL_LINK_NOT_PROTECTED, | |
ddorwin
2014/04/30 19:49:03
Will be calculated rather than reported?
xhwang
2014/04/30 21:55:29
Done.
| |
116 OUTPUT_PROTECTION_MAX | |
117 }; | |
118 | |
109 typedef linked_ptr<DecryptedBlockImpl> LinkedDecryptedBlock; | 119 typedef linked_ptr<DecryptedBlockImpl> LinkedDecryptedBlock; |
110 typedef linked_ptr<VideoFrameImpl> LinkedVideoFrame; | 120 typedef linked_ptr<VideoFrameImpl> LinkedVideoFrame; |
111 typedef linked_ptr<AudioFramesImpl> LinkedAudioFrames; | 121 typedef linked_ptr<AudioFramesImpl> LinkedAudioFrames; |
112 | 122 |
113 bool CreateCdmInstance(const std::string& key_system); | 123 bool CreateCdmInstance(const std::string& key_system); |
114 | 124 |
115 // <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to | 125 // <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to |
116 // <code>callback_factory_</code> to ensure that calls into | 126 // <code>callback_factory_</code> to ensure that calls into |
117 // <code>PPP_ContentDecryptor_Private</code> are asynchronous. | 127 // <code>PPP_ContentDecryptor_Private</code> are asynchronous. |
118 void SendSessionCreatedInternal(int32_t result, | 128 void SendSessionCreatedInternal(int32_t result, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 bool IsValidVideoFrame(const LinkedVideoFrame& video_frame); | 168 bool IsValidVideoFrame(const LinkedVideoFrame& video_frame); |
159 | 169 |
160 #if !defined(NDEBUG) | 170 #if !defined(NDEBUG) |
161 // Logs the given message to the JavaScript console associated with the | 171 // Logs the given message to the JavaScript console associated with the |
162 // CDM adapter instance. The name of the CDM adapter issuing the log message | 172 // CDM adapter instance. The name of the CDM adapter issuing the log message |
163 // will be automatically prepended to the message. | 173 // will be automatically prepended to the message. |
164 void LogToConsole(const pp::Var& value); | 174 void LogToConsole(const pp::Var& value); |
165 #endif // !defined(NDEBUG) | 175 #endif // !defined(NDEBUG) |
166 | 176 |
167 #if defined(OS_CHROMEOS) | 177 #if defined(OS_CHROMEOS) |
178 void ReportOutputProtectionStatus(OutputProtectionStatus status); | |
179 void ReportOutputProtectionQueryResult(int32_t result); | |
180 | |
168 void SendPlatformChallengeDone(int32_t result); | 181 void SendPlatformChallengeDone(int32_t result); |
169 void EnableProtectionDone(int32_t result); | 182 void EnableProtectionDone(int32_t result); |
170 void QueryOutputProtectionStatusDone(int32_t result); | 183 void QueryOutputProtectionStatusDone(int32_t result); |
171 | 184 |
172 pp::OutputProtection_Private output_protection_; | 185 pp::OutputProtection_Private output_protection_; |
173 pp::PlatformVerification platform_verification_; | 186 pp::PlatformVerification platform_verification_; |
174 | 187 |
175 // Since PPAPI doesn't provide handlers for CompletionCallbacks with more than | 188 // Since PPAPI doesn't provide handlers for CompletionCallbacks with more than |
176 // one output we need to manage our own. These values are only read by | 189 // one output we need to manage our own. These values are only read by |
177 // SendPlatformChallengeDone(). | 190 // SendPlatformChallengeDone(). |
178 pp::Var signed_data_output_; | 191 pp::Var signed_data_output_; |
179 pp::Var signed_data_signature_output_; | 192 pp::Var signed_data_signature_output_; |
180 pp::Var platform_key_certificate_output_; | 193 pp::Var platform_key_certificate_output_; |
181 bool challenge_in_progress_; | 194 bool challenge_in_progress_; |
182 | 195 |
183 // Same as above, these are only read by QueryOutputProtectionStatusDone(). | 196 // Same as above, these are only read by QueryOutputProtectionStatusDone(). |
184 uint32_t output_link_mask_; | 197 uint32_t output_link_mask_; |
185 uint32_t output_protection_mask_; | 198 uint32_t output_protection_mask_; |
186 bool query_output_protection_in_progress_; | 199 bool query_output_protection_in_progress_; |
200 | |
201 // We report the following stats to UMA: | |
202 // - Whether output protection has been queried. | |
203 // - Result of the first output protection query. | |
204 // The following two variables help track the status of the UMA reporting. | |
205 bool uma_for_output_protection_query_reported_; | |
206 bool uma_for_output_protection_result_reported_; | |
187 #endif | 207 #endif |
188 | 208 |
189 PpbBufferAllocator allocator_; | 209 PpbBufferAllocator allocator_; |
190 pp::CompletionCallbackFactory<CdmAdapter> callback_factory_; | 210 pp::CompletionCallbackFactory<CdmAdapter> callback_factory_; |
191 linked_ptr<CdmWrapper> cdm_; | 211 linked_ptr<CdmWrapper> cdm_; |
192 std::string key_system_; | 212 std::string key_system_; |
193 | 213 |
194 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() | 214 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() |
195 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is | 215 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is |
196 // saved for the future call to OnDeferredInitializationDone(). | 216 // saved for the future call to OnDeferredInitializationDone(). |
197 bool deferred_initialize_audio_decoder_; | 217 bool deferred_initialize_audio_decoder_; |
198 uint32_t deferred_audio_decoder_config_id_; | 218 uint32_t deferred_audio_decoder_config_id_; |
199 bool deferred_initialize_video_decoder_; | 219 bool deferred_initialize_video_decoder_; |
200 uint32_t deferred_video_decoder_config_id_; | 220 uint32_t deferred_video_decoder_config_id_; |
201 | 221 |
202 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); | 222 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); |
203 }; | 223 }; |
204 | 224 |
205 } // namespace media | 225 } // namespace media |
206 | 226 |
207 #endif // MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ | 227 #endif // MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ |
OLD | NEW |