Chromium Code Reviews| 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, | |
|
ddorwin
2014/04/30 23:13:35
It seems odd to have the "total" value in the same
xhwang
2014/04/30 23:48:16
Agreed. But that makes it harder to dig out data.
| |
| 112 OUTPUT_PROTECTION_QUERY_ERROR = 1, | |
|
ddorwin
2014/04/30 23:13:35
This is not "positive". Should we just consider th
xhwang
2014/04/30 23:48:16
Done.
| |
| 113 OUTPUT_PROTECTION_NO_EXTERNAL_LINK = 2, | |
| 114 OUTPUT_PROTECTION_ALL_EXTERNAL_LINKS_PROTECTED = 3, | |
| 115 OUTPUT_PROTECTION_MAX = 4 | |
| 116 }; | |
| 117 | |
| 109 typedef linked_ptr<DecryptedBlockImpl> LinkedDecryptedBlock; | 118 typedef linked_ptr<DecryptedBlockImpl> LinkedDecryptedBlock; |
| 110 typedef linked_ptr<VideoFrameImpl> LinkedVideoFrame; | 119 typedef linked_ptr<VideoFrameImpl> LinkedVideoFrame; |
| 111 typedef linked_ptr<AudioFramesImpl> LinkedAudioFrames; | 120 typedef linked_ptr<AudioFramesImpl> LinkedAudioFrames; |
| 112 | 121 |
| 113 bool CreateCdmInstance(const std::string& key_system); | 122 bool CreateCdmInstance(const std::string& key_system); |
| 114 | 123 |
| 115 // <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to | 124 // <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to |
| 116 // <code>callback_factory_</code> to ensure that calls into | 125 // <code>callback_factory_</code> to ensure that calls into |
| 117 // <code>PPP_ContentDecryptor_Private</code> are asynchronous. | 126 // <code>PPP_ContentDecryptor_Private</code> are asynchronous. |
| 118 void SendSessionCreatedInternal(int32_t result, | 127 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); | 167 bool IsValidVideoFrame(const LinkedVideoFrame& video_frame); |
| 159 | 168 |
| 160 #if !defined(NDEBUG) | 169 #if !defined(NDEBUG) |
| 161 // Logs the given message to the JavaScript console associated with the | 170 // 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 | 171 // CDM adapter instance. The name of the CDM adapter issuing the log message |
| 163 // will be automatically prepended to the message. | 172 // will be automatically prepended to the message. |
| 164 void LogToConsole(const pp::Var& value); | 173 void LogToConsole(const pp::Var& value); |
| 165 #endif // !defined(NDEBUG) | 174 #endif // !defined(NDEBUG) |
| 166 | 175 |
| 167 #if defined(OS_CHROMEOS) | 176 #if defined(OS_CHROMEOS) |
| 177 void ReportOutputProtectionStatus(OutputProtectionStatus status); | |
| 178 void ReportOutputProtectionQueryResult(int32_t result); | |
| 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 // We report the following stats to UMA: | |
| 201 // - Whether output protection has been queried. | |
| 202 // - Whether a positive result (no unprotected external link) is returned. | |
|
ddorwin
2014/04/30 23:13:35
What about QUERY_ERROR? That's not positive.
"Whe
xhwang
2014/04/30 23:48:16
Done.
| |
| 203 // The following two variables help track the status of the UMA reporting. | |
| 204 bool uma_for_output_protection_query_reported_; | |
| 205 bool uma_for_output_protection_positive_result_reported_; | |
| 187 #endif | 206 #endif |
| 188 | 207 |
| 189 PpbBufferAllocator allocator_; | 208 PpbBufferAllocator allocator_; |
| 190 pp::CompletionCallbackFactory<CdmAdapter> callback_factory_; | 209 pp::CompletionCallbackFactory<CdmAdapter> callback_factory_; |
| 191 linked_ptr<CdmWrapper> cdm_; | 210 linked_ptr<CdmWrapper> cdm_; |
| 192 std::string key_system_; | 211 std::string key_system_; |
| 193 | 212 |
| 194 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() | 213 // If the CDM returned kDeferredInitialization during InitializeAudioDecoder() |
| 195 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is | 214 // or InitializeVideoDecoder(), the (Audio|Video)DecoderConfig.request_id is |
| 196 // saved for the future call to OnDeferredInitializationDone(). | 215 // saved for the future call to OnDeferredInitializationDone(). |
| 197 bool deferred_initialize_audio_decoder_; | 216 bool deferred_initialize_audio_decoder_; |
| 198 uint32_t deferred_audio_decoder_config_id_; | 217 uint32_t deferred_audio_decoder_config_id_; |
| 199 bool deferred_initialize_video_decoder_; | 218 bool deferred_initialize_video_decoder_; |
| 200 uint32_t deferred_video_decoder_config_id_; | 219 uint32_t deferred_video_decoder_config_id_; |
| 201 | 220 |
| 202 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); | 221 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); |
| 203 }; | 222 }; |
| 204 | 223 |
| 205 } // namespace media | 224 } // namespace media |
| 206 | 225 |
| 207 #endif // MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ | 226 #endif // MEDIA_CDM_PPAPI_CDM_ADAPTER_H_ |
| OLD | NEW |