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! |
| 110 enum OutputProtectionStatus { |
| 111 OUTPUT_PROTECTION_QUERIED = 0, |
| 112 OUTPUT_PROTECTION_NO_EXTERNAL_LINK = 1, |
| 113 OUTPUT_PROTECTION_ALL_EXTERNAL_LINKS_PROTECTED = 2, |
| 114 OUTPUT_PROTECTION_MAX = 3 |
| 115 }; |
| 116 |
109 typedef linked_ptr<DecryptedBlockImpl> LinkedDecryptedBlock; | 117 typedef linked_ptr<DecryptedBlockImpl> LinkedDecryptedBlock; |
110 typedef linked_ptr<VideoFrameImpl> LinkedVideoFrame; | 118 typedef linked_ptr<VideoFrameImpl> LinkedVideoFrame; |
111 typedef linked_ptr<AudioFramesImpl> LinkedAudioFrames; | 119 typedef linked_ptr<AudioFramesImpl> LinkedAudioFrames; |
112 | 120 |
113 bool CreateCdmInstance(const std::string& key_system); | 121 bool CreateCdmInstance(const std::string& key_system); |
114 | 122 |
115 // <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to | 123 // <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to |
116 // <code>callback_factory_</code> to ensure that calls into | 124 // <code>callback_factory_</code> to ensure that calls into |
117 // <code>PPP_ContentDecryptor_Private</code> are asynchronous. | 125 // <code>PPP_ContentDecryptor_Private</code> are asynchronous. |
118 void SendSessionCreatedInternal(int32_t result, | 126 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); | 166 bool IsValidVideoFrame(const LinkedVideoFrame& video_frame); |
159 | 167 |
160 #if !defined(NDEBUG) | 168 #if !defined(NDEBUG) |
161 // Logs the given message to the JavaScript console associated with the | 169 // 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 | 170 // CDM adapter instance. The name of the CDM adapter issuing the log message |
163 // will be automatically prepended to the message. | 171 // will be automatically prepended to the message. |
164 void LogToConsole(const pp::Var& value); | 172 void LogToConsole(const pp::Var& value); |
165 #endif // !defined(NDEBUG) | 173 #endif // !defined(NDEBUG) |
166 | 174 |
167 #if defined(OS_CHROMEOS) | 175 #if defined(OS_CHROMEOS) |
| 176 void ReportOutputProtectionUMA(OutputProtectionStatus status); |
| 177 void ReportOutputProtectionQuery(); |
| 178 void ReportOutputProtectionQueryResult(); |
| 179 |
168 void SendPlatformChallengeDone(int32_t result); | 180 void SendPlatformChallengeDone(int32_t result); |
169 void EnableProtectionDone(int32_t result); | 181 void EnableProtectionDone(int32_t result); |
170 void QueryOutputProtectionStatusDone(int32_t result); | 182 void QueryOutputProtectionStatusDone(int32_t result); |
171 | 183 |
172 pp::OutputProtection_Private output_protection_; | 184 pp::OutputProtection_Private output_protection_; |
173 pp::PlatformVerification platform_verification_; | 185 pp::PlatformVerification platform_verification_; |
174 | 186 |
175 // Since PPAPI doesn't provide handlers for CompletionCallbacks with more than | 187 // 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 | 188 // one output we need to manage our own. These values are only read by |
177 // SendPlatformChallengeDone(). | 189 // SendPlatformChallengeDone(). |
178 pp::Var signed_data_output_; | 190 pp::Var signed_data_output_; |
179 pp::Var signed_data_signature_output_; | 191 pp::Var signed_data_signature_output_; |
180 pp::Var platform_key_certificate_output_; | 192 pp::Var platform_key_certificate_output_; |
181 bool challenge_in_progress_; | 193 bool challenge_in_progress_; |
182 | 194 |
183 // Same as above, these are only read by QueryOutputProtectionStatusDone(). | 195 // Same as above, these are only read by QueryOutputProtectionStatusDone(). |
184 uint32_t output_link_mask_; | 196 uint32_t output_link_mask_; |
185 uint32_t output_protection_mask_; | 197 uint32_t output_protection_mask_; |
186 bool query_output_protection_in_progress_; | 198 bool query_output_protection_in_progress_; |
| 199 |
| 200 // Tracks whether an output protection query and a positive query result (no |
| 201 // unprotected external link) have been reported to UMA. |
| 202 bool uma_for_output_protection_query_reported_; |
| 203 bool uma_for_output_protection_positive_result_reported_; |
187 #endif | 204 #endif |
188 | 205 |
189 PpbBufferAllocator allocator_; | 206 PpbBufferAllocator allocator_; |
190 pp::CompletionCallbackFactory<CdmAdapter> callback_factory_; | 207 pp::CompletionCallbackFactory<CdmAdapter> callback_factory_; |
191 linked_ptr<CdmWrapper> cdm_; | 208 linked_ptr<CdmWrapper> cdm_; |
192 std::string key_system_; | 209 std::string key_system_; |
193 | 210 |
194 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() | 211 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() |
195 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is | 212 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is |
196 // saved for the future call to OnDeferredInitializationDone(). | 213 // saved for the future call to OnDeferredInitializationDone(). |
197 bool deferred_initialize_audio_decoder_; | 214 bool deferred_initialize_audio_decoder_; |
198 uint32_t deferred_audio_decoder_config_id_; | 215 uint32_t deferred_audio_decoder_config_id_; |
199 bool deferred_initialize_video_decoder_; | 216 bool deferred_initialize_video_decoder_; |
200 uint32_t deferred_video_decoder_config_id_; | 217 uint32_t deferred_video_decoder_config_id_; |
201 | 218 |
202 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); | 219 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); |
203 }; | 220 }; |
204 | 221 |
205 } // namespace media | 222 } // namespace media |
206 | 223 |
207 #endif // MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ | 224 #endif // MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ |
OLD | NEW |