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

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

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 3 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 void AcmReceiveTest::Run() { 88 void AcmReceiveTest::Run() {
89 for (rtc::scoped_ptr<Packet> packet(packet_source_->NextPacket()); packet; 89 for (rtc::scoped_ptr<Packet> packet(packet_source_->NextPacket()); packet;
90 packet.reset(packet_source_->NextPacket())) { 90 packet.reset(packet_source_->NextPacket())) {
91 // Pull audio until time to insert packet. 91 // Pull audio until time to insert packet.
92 while (clock_.TimeInMilliseconds() < packet->time_ms()) { 92 while (clock_.TimeInMilliseconds() < packet->time_ms()) {
93 AudioFrame output_frame; 93 AudioFrame output_frame;
94 EXPECT_TRUE(acm_->Get10MsAudio(&output_frame)); 94 EXPECT_TRUE(acm_->Get10MsAudio(&output_frame));
95 EXPECT_EQ(output_freq_hz_, output_frame.sample_rate_hz_); 95 EXPECT_EQ(output_freq_hz_, output_frame.sample_rate_hz_);
96 const int samples_per_block = output_freq_hz_ * 10 / 1000; 96 const size_t samples_per_block =
97 static_cast<size_t>(output_freq_hz_ * 10 / 1000);
97 EXPECT_EQ(samples_per_block, output_frame.samples_per_channel_); 98 EXPECT_EQ(samples_per_block, output_frame.samples_per_channel_);
98 if (expected_output_channels_ != kArbitraryChannels) { 99 if (expected_output_channels_ != kArbitraryChannels) {
99 if (output_frame.speech_type_ == webrtc::AudioFrame::kPLC) { 100 if (output_frame.speech_type_ == webrtc::AudioFrame::kPLC) {
100 // Don't check number of channels for PLC output, since each test run 101 // Don't check number of channels for PLC output, since each test run
101 // usually starts with a short period of mono PLC before decoding the 102 // usually starts with a short period of mono PLC before decoding the
102 // first packet. 103 // first packet.
103 } else { 104 } else {
104 EXPECT_EQ(expected_output_channels_, output_frame.num_channels_); 105 EXPECT_EQ(expected_output_channels_, output_frame.num_channels_);
105 } 106 }
106 } 107 }
(...skipping 11 matching lines...) Expand all
118 header)) 119 header))
119 << "Failure when inserting packet:" << std::endl 120 << "Failure when inserting packet:" << std::endl
120 << " PT = " << static_cast<int>(header.header.payloadType) << std::endl 121 << " PT = " << static_cast<int>(header.header.payloadType) << std::endl
121 << " TS = " << header.header.timestamp << std::endl 122 << " TS = " << header.header.timestamp << std::endl
122 << " SN = " << header.header.sequenceNumber; 123 << " SN = " << header.header.sequenceNumber;
123 } 124 }
124 } 125 }
125 126
126 } // namespace test 127 } // namespace test
127 } // namespace webrtc 128 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698