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

Unified Diff: webrtc/common_audio/audio_converter_unittest.cc

Issue 1534193008: Misc. small cleanups (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Unnecessary parens Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/audio/audio_send_stream_unittest.cc ('k') | webrtc/common_audio/blocker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_audio/audio_converter_unittest.cc
diff --git a/webrtc/common_audio/audio_converter_unittest.cc b/webrtc/common_audio/audio_converter_unittest.cc
index c85b96e28589bbc92ac424879aed402260de0b41..e373d78b46316c5b0ede89f447746914f4857810 100644
--- a/webrtc/common_audio/audio_converter_unittest.cc
+++ b/webrtc/common_audio/audio_converter_unittest.cc
@@ -13,6 +13,7 @@
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
+#include "webrtc/base/arraysize.h"
#include "webrtc/base/format_macros.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/audio_converter.h"
@@ -24,11 +25,11 @@ namespace webrtc {
typedef rtc::scoped_ptr<ChannelBuffer<float>> ScopedBuffer;
// Sets the signal value to increase by |data| with every sample.
-ScopedBuffer CreateBuffer(const std::vector<float>& data, int frames) {
+ScopedBuffer CreateBuffer(const std::vector<float>& data, size_t frames) {
const int num_channels = static_cast<int>(data.size());
ScopedBuffer sb(new ChannelBuffer<float>(frames, num_channels));
for (int i = 0; i < num_channels; ++i)
- for (int j = 0; j < frames; ++j)
+ for (size_t j = 0; j < frames; ++j)
sb->channels()[i][j] = data[i] * j;
return sb;
}
@@ -96,8 +97,8 @@ void RunAudioConverterTest(int src_channels,
const float dst_left = resampling_factor * kSrcLeft;
const float dst_right = resampling_factor * kSrcRight;
const float dst_mono = (dst_left + dst_right) / 2;
- const int src_frames = src_sample_rate_hz / 100;
- const int dst_frames = dst_sample_rate_hz / 100;
+ const size_t src_frames = static_cast<size_t>(src_sample_rate_hz / 100);
+ const size_t dst_frames = static_cast<size_t>(dst_sample_rate_hz / 100);
std::vector<float> src_data(1, kSrcLeft);
if (src_channels == 2)
@@ -141,13 +142,13 @@ void RunAudioConverterTest(int src_channels,
TEST(AudioConverterTest, ConversionsPassSNRThreshold) {
const int kSampleRates[] = {8000, 16000, 32000, 44100, 48000};
- const int kSampleRatesSize = sizeof(kSampleRates) / sizeof(*kSampleRates);
const int kChannels[] = {1, 2};
- const int kChannelsSize = sizeof(kChannels) / sizeof(*kChannels);
- for (int src_rate = 0; src_rate < kSampleRatesSize; ++src_rate) {
- for (int dst_rate = 0; dst_rate < kSampleRatesSize; ++dst_rate) {
- for (int src_channel = 0; src_channel < kChannelsSize; ++src_channel) {
- for (int dst_channel = 0; dst_channel < kChannelsSize; ++dst_channel) {
+ for (size_t src_rate = 0; src_rate < arraysize(kSampleRates); ++src_rate) {
+ for (size_t dst_rate = 0; dst_rate < arraysize(kSampleRates); ++dst_rate) {
+ for (size_t src_channel = 0; src_channel < arraysize(kChannels);
+ ++src_channel) {
+ for (size_t dst_channel = 0; dst_channel < arraysize(kChannels);
+ ++dst_channel) {
RunAudioConverterTest(kChannels[src_channel], kSampleRates[src_rate],
kChannels[dst_channel], kSampleRates[dst_rate]);
}
« no previous file with comments | « webrtc/audio/audio_send_stream_unittest.cc ('k') | webrtc/common_audio/blocker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698