| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/cdm_adapter.h" | 5 #include "media/cdm/cdm_adapter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" | |
| 14 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 17 #include "media/base/audio_decoder_config.h" | 16 #include "media/base/audio_decoder_config.h" |
| 18 #include "media/base/cdm_initialized_promise.h" | 17 #include "media/base/cdm_initialized_promise.h" |
| 19 #include "media/base/cdm_key_information.h" | 18 #include "media/base/cdm_key_information.h" |
| 20 #include "media/base/channel_layout.h" | 19 #include "media/base/channel_layout.h" |
| 21 #include "media/base/decoder_buffer.h" | 20 #include "media/base/decoder_buffer.h" |
| 22 #include "media/base/decrypt_config.h" | 21 #include "media/base/decrypt_config.h" |
| 23 #include "media/base/limits.h" | 22 #include "media/base/limits.h" |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 uint32_t session_id_size, | 779 uint32_t session_id_size, |
| 781 bool has_additional_usable_key, | 780 bool has_additional_usable_key, |
| 782 const cdm::KeyInformation* keys_info, | 781 const cdm::KeyInformation* keys_info, |
| 783 uint32_t keys_info_count) { | 782 uint32_t keys_info_count) { |
| 784 DCHECK(task_runner_->BelongsToCurrentThread()); | 783 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 785 | 784 |
| 786 CdmKeysInfo keys; | 785 CdmKeysInfo keys; |
| 787 keys.reserve(keys_info_count); | 786 keys.reserve(keys_info_count); |
| 788 for (uint32_t i = 0; i < keys_info_count; ++i) { | 787 for (uint32_t i = 0; i < keys_info_count; ++i) { |
| 789 const auto& info = keys_info[i]; | 788 const auto& info = keys_info[i]; |
| 790 keys.push_back(base::MakeUnique<CdmKeyInformation>( | 789 keys.push_back(new CdmKeyInformation( |
| 791 info.key_id, info.key_id_size, | 790 info.key_id, info.key_id_size, |
| 792 ToCdmKeyInformationKeyStatus(info.status), info.system_code)); | 791 ToCdmKeyInformationKeyStatus(info.status), info.system_code)); |
| 793 } | 792 } |
| 794 | 793 |
| 795 // TODO(jrummell): Handling resume playback should be done in the media | 794 // TODO(jrummell): Handling resume playback should be done in the media |
| 796 // player, not in the Decryptors. http://crbug.com/413413. | 795 // player, not in the Decryptors. http://crbug.com/413413. |
| 797 if (has_additional_usable_key) { | 796 if (has_additional_usable_key) { |
| 798 if (!new_audio_key_cb_.is_null()) | 797 if (!new_audio_key_cb_.is_null()) |
| 799 new_audio_key_cb_.Run(); | 798 new_audio_key_cb_.Run(); |
| 800 if (!new_video_key_cb_.is_null()) | 799 if (!new_video_key_cb_.is_null()) |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 result_frames->push_back(frame); | 940 result_frames->push_back(frame); |
| 942 | 941 |
| 943 data += frame_size; | 942 data += frame_size; |
| 944 bytes_left -= frame_size; | 943 bytes_left -= frame_size; |
| 945 } while (bytes_left > 0); | 944 } while (bytes_left > 0); |
| 946 | 945 |
| 947 return true; | 946 return true; |
| 948 } | 947 } |
| 949 | 948 |
| 950 } // namespace media | 949 } // namespace media |
| OLD | NEW |