OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 assert(codec_registered_); | 79 assert(codec_registered_); |
80 if (filter_.test(static_cast<size_t>(payload_type_))) { | 80 if (filter_.test(static_cast<size_t>(payload_type_))) { |
81 // This payload type should be filtered out. Since the payload type is the | 81 // This payload type should be filtered out. Since the payload type is the |
82 // same throughout the whole test run, no packet at all will be delivered. | 82 // same throughout the whole test run, no packet at all will be delivered. |
83 // We can just as well signal that the test is over by returning NULL. | 83 // We can just as well signal that the test is over by returning NULL. |
84 return nullptr; | 84 return nullptr; |
85 } | 85 } |
86 // Insert audio and process until one packet is produced. | 86 // Insert audio and process until one packet is produced. |
87 while (clock_.TimeInMilliseconds() < test_duration_ms_) { | 87 while (clock_.TimeInMilliseconds() < test_duration_ms_) { |
88 clock_.AdvanceTimeMilliseconds(kBlockSizeMs); | 88 clock_.AdvanceTimeMilliseconds(kBlockSizeMs); |
89 RTC_CHECK( | 89 RTC_CHECK(audio_source_->Read(input_block_size_samples_, |
90 audio_source_->Read(input_block_size_samples_, input_frame_.data_)); | 90 input_frame_.mutable_data())); |
91 if (input_frame_.num_channels_ > 1) { | 91 if (input_frame_.num_channels_ > 1) { |
92 InputAudioFile::DuplicateInterleaved(input_frame_.data_, | 92 InputAudioFile::DuplicateInterleaved(input_frame_.data(), |
93 input_block_size_samples_, | 93 input_block_size_samples_, |
94 input_frame_.num_channels_, | 94 input_frame_.num_channels_, |
95 input_frame_.data_); | 95 input_frame_.mutable_data()); |
96 } | 96 } |
97 data_to_send_ = false; | 97 data_to_send_ = false; |
98 RTC_CHECK_GE(acm_->Add10MsData(input_frame_), 0); | 98 RTC_CHECK_GE(acm_->Add10MsData(input_frame_), 0); |
99 input_frame_.timestamp_ += static_cast<uint32_t>(input_block_size_samples_); | 99 input_frame_.timestamp_ += static_cast<uint32_t>(input_block_size_samples_); |
100 if (data_to_send_) { | 100 if (data_to_send_) { |
101 // Encoded packet received. | 101 // Encoded packet received. |
102 return CreatePacket(); | 102 return CreatePacket(); |
103 } | 103 } |
104 } | 104 } |
105 // Test ended. | 105 // Test ended. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 last_payload_vec_.size()); | 151 last_payload_vec_.size()); |
152 std::unique_ptr<Packet> packet( | 152 std::unique_ptr<Packet> packet( |
153 new Packet(packet_memory, allocated_bytes, clock_.TimeInMilliseconds())); | 153 new Packet(packet_memory, allocated_bytes, clock_.TimeInMilliseconds())); |
154 RTC_DCHECK(packet); | 154 RTC_DCHECK(packet); |
155 RTC_DCHECK(packet->valid_header()); | 155 RTC_DCHECK(packet->valid_header()); |
156 return packet; | 156 return packet; |
157 } | 157 } |
158 | 158 |
159 } // namespace test | 159 } // namespace test |
160 } // namespace webrtc | 160 } // namespace webrtc |
OLD | NEW |