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