Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/acm_receive_test_oldapi.cc

Issue 1225133003: Update audio code to use size_t more correctly, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comment Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 void AcmReceiveTestOldApi::Run() { 146 void AcmReceiveTestOldApi::Run() {
147 for (rtc::scoped_ptr<Packet> packet(packet_source_->NextPacket()); packet; 147 for (rtc::scoped_ptr<Packet> packet(packet_source_->NextPacket()); packet;
148 packet.reset(packet_source_->NextPacket())) { 148 packet.reset(packet_source_->NextPacket())) {
149 // Pull audio until time to insert packet. 149 // Pull audio until time to insert packet.
150 while (clock_.TimeInMilliseconds() < packet->time_ms()) { 150 while (clock_.TimeInMilliseconds() < packet->time_ms()) {
151 AudioFrame output_frame; 151 AudioFrame output_frame;
152 EXPECT_EQ(0, acm_->PlayoutData10Ms(output_freq_hz_, &output_frame)); 152 EXPECT_EQ(0, acm_->PlayoutData10Ms(output_freq_hz_, &output_frame));
153 EXPECT_EQ(output_freq_hz_, output_frame.sample_rate_hz_); 153 EXPECT_EQ(output_freq_hz_, output_frame.sample_rate_hz_);
154 const int samples_per_block = output_freq_hz_ * 10 / 1000; 154 const size_t samples_per_block =
155 static_cast<size_t>(output_freq_hz_ * 10 / 1000);
155 EXPECT_EQ(samples_per_block, output_frame.samples_per_channel_); 156 EXPECT_EQ(samples_per_block, output_frame.samples_per_channel_);
156 if (exptected_output_channels_ != kArbitraryChannels) { 157 if (exptected_output_channels_ != kArbitraryChannels) {
157 if (output_frame.speech_type_ == webrtc::AudioFrame::kPLC) { 158 if (output_frame.speech_type_ == webrtc::AudioFrame::kPLC) {
158 // Don't check number of channels for PLC output, since each test run 159 // Don't check number of channels for PLC output, since each test run
159 // usually starts with a short period of mono PLC before decoding the 160 // usually starts with a short period of mono PLC before decoding the
160 // first packet. 161 // first packet.
161 } else { 162 } else {
162 EXPECT_EQ(exptected_output_channels_, output_frame.num_channels_); 163 EXPECT_EQ(exptected_output_channels_, output_frame.num_channels_);
163 } 164 }
164 } 165 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) { 206 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) {
206 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_) 207 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_)
207 ? output_freq_hz_2_ 208 ? output_freq_hz_2_
208 : output_freq_hz_1_; 209 : output_freq_hz_1_;
209 last_toggle_time_ms_ = clock_.TimeInMilliseconds(); 210 last_toggle_time_ms_ = clock_.TimeInMilliseconds();
210 } 211 }
211 } 212 }
212 213
213 } // namespace test 214 } // namespace test
214 } // namespace webrtc 215 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/acm_receive_test.cc ('k') | webrtc/modules/audio_coding/main/acm2/acm_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698