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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 sample_rate_hz, num_channels, name); | 152 sample_rate_hz, num_channels, name); |
153 } | 153 } |
154 | 154 |
155 void AcmReceiveTestOldApi::Run() { | 155 void AcmReceiveTestOldApi::Run() { |
156 for (std::unique_ptr<Packet> packet(packet_source_->NextPacket()); packet; | 156 for (std::unique_ptr<Packet> packet(packet_source_->NextPacket()); packet; |
157 packet.reset(packet_source_->NextPacket())) { | 157 packet.reset(packet_source_->NextPacket())) { |
158 // Pull audio until time to insert packet. | 158 // Pull audio until time to insert packet. |
159 while (clock_.TimeInMilliseconds() < packet->time_ms()) { | 159 while (clock_.TimeInMilliseconds() < packet->time_ms()) { |
160 AudioFrame output_frame; | 160 AudioFrame output_frame; |
161 EXPECT_EQ(0, acm_->PlayoutData10Ms(output_freq_hz_, &output_frame)); | 161 EXPECT_EQ(0, acm_->PlayoutData10Ms(output_freq_hz_, &output_frame)); |
162 EXPECT_EQ(output_freq_hz_, output_frame.sample_rate_hz_); | 162 ASSERT_EQ(output_freq_hz_, output_frame.sample_rate_hz_); |
163 const size_t samples_per_block = | 163 const size_t samples_per_block = |
164 static_cast<size_t>(output_freq_hz_ * 10 / 1000); | 164 static_cast<size_t>(output_freq_hz_ * 10 / 1000); |
165 EXPECT_EQ(samples_per_block, output_frame.samples_per_channel_); | 165 EXPECT_EQ(samples_per_block, output_frame.samples_per_channel_); |
166 if (exptected_output_channels_ != kArbitraryChannels) { | 166 if (exptected_output_channels_ != kArbitraryChannels) { |
167 if (output_frame.speech_type_ == webrtc::AudioFrame::kPLC) { | 167 if (output_frame.speech_type_ == webrtc::AudioFrame::kPLC) { |
168 // Don't check number of channels for PLC output, since each test run | 168 // Don't check number of channels for PLC output, since each test run |
169 // usually starts with a short period of mono PLC before decoding the | 169 // usually starts with a short period of mono PLC before decoding the |
170 // first packet. | 170 // first packet. |
171 } else { | 171 } else { |
172 EXPECT_EQ(exptected_output_channels_, output_frame.num_channels_); | 172 EXPECT_EQ(exptected_output_channels_, output_frame.num_channels_); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) { | 215 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) { |
216 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_) | 216 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_) |
217 ? output_freq_hz_2_ | 217 ? output_freq_hz_2_ |
218 : output_freq_hz_1_; | 218 : output_freq_hz_1_; |
219 last_toggle_time_ms_ = clock_.TimeInMilliseconds(); | 219 last_toggle_time_ms_ = clock_.TimeInMilliseconds(); |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 } // namespace test | 223 } // namespace test |
224 } // namespace webrtc | 224 } // namespace webrtc |
OLD | NEW |