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

Side by Side Diff: webrtc/modules/audio_device/test/audio_device_test_api.cc

Issue 1172163004: Reformat existing code. There should be no functional effects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 6 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 class AudioTransportAPI: public AudioTransport { 76 class AudioTransportAPI: public AudioTransport {
77 public: 77 public:
78 AudioTransportAPI(AudioDeviceModule* audioDevice) 78 AudioTransportAPI(AudioDeviceModule* audioDevice)
79 : rec_count_(0), 79 : rec_count_(0),
80 play_count_(0) { 80 play_count_(0) {
81 } 81 }
82 82
83 ~AudioTransportAPI() {} 83 ~AudioTransportAPI() {}
84 84
85 virtual int32_t RecordedDataIsAvailable( 85 int32_t RecordedDataIsAvailable(const void* audioSamples,
86 const void* audioSamples, 86 const uint32_t nSamples,
87 const uint32_t nSamples, 87 const uint8_t nBytesPerSample,
88 const uint8_t nBytesPerSample, 88 const uint8_t nChannels,
89 const uint8_t nChannels, 89 const uint32_t sampleRate,
90 const uint32_t sampleRate, 90 const uint32_t totalDelay,
91 const uint32_t totalDelay, 91 const int32_t clockSkew,
92 const int32_t clockSkew, 92 const uint32_t currentMicLevel,
93 const uint32_t currentMicLevel, 93 const bool keyPressed,
94 const bool keyPressed, 94 uint32_t& newMicLevel) override {
95 uint32_t& newMicLevel) {
96 rec_count_++; 95 rec_count_++;
97 if (rec_count_ % 100 == 0) { 96 if (rec_count_ % 100 == 0) {
98 if (nChannels == 1) { 97 if (nChannels == 1) {
99 // mono 98 // mono
100 TEST_LOG("-"); 99 TEST_LOG("-");
101 } else if ((nChannels == 2) && (nBytesPerSample == 2)) { 100 } else if ((nChannels == 2) && (nBytesPerSample == 2)) {
102 // stereo but only using one channel 101 // stereo but only using one channel
103 TEST_LOG("-|"); 102 TEST_LOG("-|");
104 } else { 103 } else {
105 // stereo 104 // stereo
106 TEST_LOG("--"); 105 TEST_LOG("--");
107 } 106 }
108 } 107 }
109 return 0; 108 return 0;
110 } 109 }
111 110
112 virtual int32_t NeedMorePlayData( 111 int32_t NeedMorePlayData(const uint32_t nSamples,
113 const uint32_t nSamples, 112 const uint8_t nBytesPerSample,
114 const uint8_t nBytesPerSample, 113 const uint8_t nChannels,
115 const uint8_t nChannels, 114 const uint32_t sampleRate,
116 const uint32_t sampleRate, 115 void* audioSamples,
117 void* audioSamples, 116 uint32_t& nSamplesOut,
118 uint32_t& nSamplesOut, 117 int64_t* elapsed_time_ms,
119 int64_t* elapsed_time_ms, 118 int64_t* ntp_time_ms) override {
120 int64_t* ntp_time_ms) {
121 play_count_++; 119 play_count_++;
122 if (play_count_ % 100 == 0) { 120 if (play_count_ % 100 == 0) {
123 if (nChannels == 1) { 121 if (nChannels == 1) {
124 TEST_LOG("+"); 122 TEST_LOG("+");
125 } else { 123 } else {
126 TEST_LOG("++"); 124 TEST_LOG("++");
127 } 125 }
128 } 126 }
129 nSamplesOut = 480; 127 nSamplesOut = 480;
130 return 0; 128 return 0;
131 } 129 }
132 130
133 virtual int OnDataAvailable(const int voe_channels[], 131 int OnDataAvailable(const int voe_channels[],
134 int number_of_voe_channels, 132 int number_of_voe_channels,
135 const int16_t* audio_data, 133 const int16_t* audio_data,
136 int sample_rate, 134 int sample_rate,
137 int number_of_channels, 135 int number_of_channels,
138 int number_of_frames, 136 int number_of_frames,
139 int audio_delay_milliseconds, 137 int audio_delay_milliseconds,
140 int current_volume, 138 int current_volume,
141 bool key_pressed, 139 bool key_pressed,
142 bool need_audio_processing) { 140 bool need_audio_processing) override {
143 return 0; 141 return 0;
144 } 142 }
145 143
146 virtual void PushCaptureData(int voe_channel, const void* audio_data, 144 void PushCaptureData(int voe_channel, const void* audio_data,
147 int bits_per_sample, int sample_rate, 145 int bits_per_sample, int sample_rate,
148 int number_of_channels, 146 int number_of_channels,
149 int number_of_frames) {} 147 int number_of_frames) override {}
150 148
151 virtual void PullRenderData(int bits_per_sample, int sample_rate, 149 void PullRenderData(int bits_per_sample, int sample_rate,
152 int number_of_channels, int number_of_frames, 150 int number_of_channels, int number_of_frames,
153 void* audio_data, 151 void* audio_data,
154 int64_t* elapsed_time_ms, 152 int64_t* elapsed_time_ms,
155 int64_t* ntp_time_ms) {} 153 int64_t* ntp_time_ms) override {}
156 private: 154 private:
157 uint32_t rec_count_; 155 uint32_t rec_count_;
158 uint32_t play_count_; 156 uint32_t play_count_;
159 }; 157 };
160 158
161 class AudioDeviceAPITest: public testing::Test { 159 class AudioDeviceAPITest: public testing::Test {
162 protected: 160 protected:
163 AudioDeviceAPITest() {} 161 AudioDeviceAPITest() {}
164 162
165 virtual ~AudioDeviceAPITest() {} 163 virtual ~AudioDeviceAPITest() {}
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 // TODO(kjellander): Fix so these tests pass on Mac. 1822 // TODO(kjellander): Fix so these tests pass on Mac.
1825 #if !defined(WEBRTC_MAC) 1823 #if !defined(WEBRTC_MAC)
1826 EXPECT_EQ(0, audio_device_->InitPlayout()); 1824 EXPECT_EQ(0, audio_device_->InitPlayout());
1827 EXPECT_EQ(0, audio_device_->StartPlayout()); 1825 EXPECT_EQ(0, audio_device_->StartPlayout());
1828 #endif 1826 #endif
1829 1827
1830 EXPECT_EQ(-1, audio_device_->GetLoudspeakerStatus(&loudspeakerOn)); 1828 EXPECT_EQ(-1, audio_device_->GetLoudspeakerStatus(&loudspeakerOn));
1831 #endif 1829 #endif
1832 EXPECT_EQ(0, audio_device_->StopPlayout()); 1830 EXPECT_EQ(0, audio_device_->StopPlayout());
1833 } 1831 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698