| 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 #include "media/cdm/proxy_decryptor.h" | 5 #include "media/cdm/proxy_decryptor.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 EmeInitDataType init_data_type, | 31 EmeInitDataType init_data_type, |
| 32 const std::vector<uint8>& init_data) | 32 const std::vector<uint8>& init_data) |
| 33 : init_data_type(init_data_type), init_data(init_data) { | 33 : init_data_type(init_data_type), init_data(init_data) { |
| 34 } | 34 } |
| 35 | 35 |
| 36 ProxyDecryptor::PendingGenerateKeyRequestData:: | 36 ProxyDecryptor::PendingGenerateKeyRequestData:: |
| 37 ~PendingGenerateKeyRequestData() { | 37 ~PendingGenerateKeyRequestData() { |
| 38 } | 38 } |
| 39 | 39 |
| 40 ProxyDecryptor::ProxyDecryptor(MediaPermission* media_permission, | 40 ProxyDecryptor::ProxyDecryptor(MediaPermission* media_permission, |
| 41 bool use_hw_secure_codecs, |
| 41 const KeyAddedCB& key_added_cb, | 42 const KeyAddedCB& key_added_cb, |
| 42 const KeyErrorCB& key_error_cb, | 43 const KeyErrorCB& key_error_cb, |
| 43 const KeyMessageCB& key_message_cb) | 44 const KeyMessageCB& key_message_cb) |
| 44 : is_creating_cdm_(false), | 45 : is_creating_cdm_(false), |
| 45 media_permission_(media_permission), | 46 media_permission_(media_permission), |
| 47 use_hw_secure_codecs_(use_hw_secure_codecs), |
| 46 key_added_cb_(key_added_cb), | 48 key_added_cb_(key_added_cb), |
| 47 key_error_cb_(key_error_cb), | 49 key_error_cb_(key_error_cb), |
| 48 key_message_cb_(key_message_cb), | 50 key_message_cb_(key_message_cb), |
| 49 is_clear_key_(false), | 51 is_clear_key_(false), |
| 50 weak_ptr_factory_(this) { | 52 weak_ptr_factory_(this) { |
| 51 DCHECK(media_permission); | 53 DCHECK(media_permission); |
| 52 DCHECK(!key_added_cb_.is_null()); | 54 DCHECK(!key_added_cb_.is_null()); |
| 53 DCHECK(!key_error_cb_.is_null()); | 55 DCHECK(!key_error_cb_.is_null()); |
| 54 DCHECK(!key_message_cb_.is_null()); | 56 DCHECK(!key_message_cb_.is_null()); |
| 55 } | 57 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 66 DVLOG(1) << __FUNCTION__ << ": key_system = " << key_system; | 68 DVLOG(1) << __FUNCTION__ << ": key_system = " << key_system; |
| 67 DCHECK(!is_creating_cdm_); | 69 DCHECK(!is_creating_cdm_); |
| 68 DCHECK(!media_keys_); | 70 DCHECK(!media_keys_); |
| 69 | 71 |
| 70 // TODO(sandersd): Trigger permissions check here and use it to determine | 72 // TODO(sandersd): Trigger permissions check here and use it to determine |
| 71 // distinctive identifier support, instead of always requiring the | 73 // distinctive identifier support, instead of always requiring the |
| 72 // permission. http://crbug.com/455271 | 74 // permission. http://crbug.com/455271 |
| 73 CdmConfig cdm_config; | 75 CdmConfig cdm_config; |
| 74 cdm_config.allow_distinctive_identifier = true; | 76 cdm_config.allow_distinctive_identifier = true; |
| 75 cdm_config.allow_persistent_state = true; | 77 cdm_config.allow_persistent_state = true; |
| 78 cdm_config.use_hw_secure_codecs = use_hw_secure_codecs_; |
| 76 | 79 |
| 77 is_creating_cdm_ = true; | 80 is_creating_cdm_ = true; |
| 78 | 81 |
| 79 base::WeakPtr<ProxyDecryptor> weak_this = weak_ptr_factory_.GetWeakPtr(); | 82 base::WeakPtr<ProxyDecryptor> weak_this = weak_ptr_factory_.GetWeakPtr(); |
| 80 cdm_factory->Create( | 83 cdm_factory->Create( |
| 81 key_system, security_origin, cdm_config, | 84 key_system, security_origin, cdm_config, |
| 82 base::Bind(&ProxyDecryptor::OnSessionMessage, weak_this), | 85 base::Bind(&ProxyDecryptor::OnSessionMessage, weak_this), |
| 83 base::Bind(&ProxyDecryptor::OnSessionClosed, weak_this), | 86 base::Bind(&ProxyDecryptor::OnSessionClosed, weak_this), |
| 84 base::Bind(&ProxyDecryptor::OnLegacySessionError, weak_this), | 87 base::Bind(&ProxyDecryptor::OnLegacySessionError, weak_this), |
| 85 base::Bind(&ProxyDecryptor::OnSessionKeysChange, weak_this), | 88 base::Bind(&ProxyDecryptor::OnSessionKeysChange, weak_this), |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 bool is_persistent = | 393 bool is_persistent = |
| 391 session_type == PersistentSession || session_type == LoadSession; | 394 session_type == PersistentSession || session_type == LoadSession; |
| 392 active_sessions_.insert(std::make_pair(session_id, is_persistent)); | 395 active_sessions_.insert(std::make_pair(session_id, is_persistent)); |
| 393 | 396 |
| 394 // For LoadSession(), generate the KeyAdded event. | 397 // For LoadSession(), generate the KeyAdded event. |
| 395 if (session_type == LoadSession) | 398 if (session_type == LoadSession) |
| 396 GenerateKeyAdded(session_id); | 399 GenerateKeyAdded(session_id); |
| 397 } | 400 } |
| 398 | 401 |
| 399 } // namespace media | 402 } // namespace media |
| OLD | NEW |