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

Side by Side Diff: webrtc/common_audio/resampler/resampler_unittest.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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // with number of channels and ResamplerType as input. 91 // with number of channels and ResamplerType as input.
92 TEST_F(ResamplerTest, Mono) { 92 TEST_F(ResamplerTest, Mono) {
93 const int kChannels = 1; 93 const int kChannels = 1;
94 for (size_t i = 0; i < kRatesSize; ++i) { 94 for (size_t i = 0; i < kRatesSize; ++i) {
95 for (size_t j = 0; j < kRatesSize; ++j) { 95 for (size_t j = 0; j < kRatesSize; ++j) {
96 std::ostringstream ss; 96 std::ostringstream ss;
97 ss << "Input rate: " << kRates[i] << ", output rate: " << kRates[j]; 97 ss << "Input rate: " << kRates[i] << ", output rate: " << kRates[j];
98 SCOPED_TRACE(ss.str()); 98 SCOPED_TRACE(ss.str());
99 99
100 if (ValidRates(kRates[i], kRates[j])) { 100 if (ValidRates(kRates[i], kRates[j])) {
101 int in_length = kRates[i] / 100; 101 size_t in_length = static_cast<size_t>(kRates[i] / 100);
102 int out_length = 0; 102 size_t out_length = 0;
103 EXPECT_EQ(0, rs_.Reset(kRates[i], kRates[j], kChannels)); 103 EXPECT_EQ(0, rs_.Reset(kRates[i], kRates[j], kChannels));
104 EXPECT_EQ(0, rs_.Push(data_in_, in_length, data_out_, kDataSize, 104 EXPECT_EQ(0, rs_.Push(data_in_, in_length, data_out_, kDataSize,
105 out_length)); 105 out_length));
106 EXPECT_EQ(kRates[j] / 100, out_length); 106 EXPECT_EQ(static_cast<size_t>(kRates[j] / 100), out_length);
107 } else { 107 } else {
108 EXPECT_EQ(-1, rs_.Reset(kRates[i], kRates[j], kChannels)); 108 EXPECT_EQ(-1, rs_.Reset(kRates[i], kRates[j], kChannels));
109 } 109 }
110 } 110 }
111 } 111 }
112 } 112 }
113 113
114 TEST_F(ResamplerTest, Stereo) { 114 TEST_F(ResamplerTest, Stereo) {
115 const int kChannels = 2; 115 const int kChannels = 2;
116 for (size_t i = 0; i < kRatesSize; ++i) { 116 for (size_t i = 0; i < kRatesSize; ++i) {
117 for (size_t j = 0; j < kRatesSize; ++j) { 117 for (size_t j = 0; j < kRatesSize; ++j) {
118 std::ostringstream ss; 118 std::ostringstream ss;
119 ss << "Input rate: " << kRates[i] << ", output rate: " << kRates[j]; 119 ss << "Input rate: " << kRates[i] << ", output rate: " << kRates[j];
120 SCOPED_TRACE(ss.str()); 120 SCOPED_TRACE(ss.str());
121 121
122 if (ValidRates(kRates[i], kRates[j])) { 122 if (ValidRates(kRates[i], kRates[j])) {
123 int in_length = kChannels * kRates[i] / 100; 123 size_t in_length = static_cast<size_t>(kChannels * kRates[i] / 100);
124 int out_length = 0; 124 size_t out_length = 0;
125 EXPECT_EQ(0, rs_.Reset(kRates[i], kRates[j], 125 EXPECT_EQ(0, rs_.Reset(kRates[i], kRates[j],
126 kChannels)); 126 kChannels));
127 EXPECT_EQ(0, rs_.Push(data_in_, in_length, data_out_, kDataSize, 127 EXPECT_EQ(0, rs_.Push(data_in_, in_length, data_out_, kDataSize,
128 out_length)); 128 out_length));
129 EXPECT_EQ(kChannels * kRates[j] / 100, out_length); 129 EXPECT_EQ(static_cast<size_t>(kChannels * kRates[j] / 100), out_length);
130 } else { 130 } else {
131 EXPECT_EQ(-1, rs_.Reset(kRates[i], kRates[j], 131 EXPECT_EQ(-1, rs_.Reset(kRates[i], kRates[j],
132 kChannels)); 132 kChannels));
133 } 133 }
134 } 134 }
135 } 135 }
136 } 136 }
137 137
138 } // namespace 138 } // namespace
139 } // namespace webrtc 139 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_audio/resampler/resampler.cc ('k') | webrtc/common_audio/resampler/sinc_resampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698