OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 const base::TimeDelta output_buffer_duration = | 115 const base::TimeDelta output_buffer_duration = |
116 expected_output_buffer_size * base::TimeDelta::FromSeconds(1) / | 116 expected_output_buffer_size * base::TimeDelta::FromSeconds(1) / |
117 expected_output_sample_rate; | 117 expected_output_sample_rate; |
118 for (int i = 0; i < kNumberOfPacketsForTest; ++i) { | 118 for (int i = 0; i < kNumberOfPacketsForTest; ++i) { |
119 data_bus->FromInterleaved(data_ptr, data_bus->frames(), 2); | 119 data_bus->FromInterleaved(data_ptr, data_bus->frames(), 2); |
120 audio_processor->PushCaptureData(*data_bus, input_capture_delay); | 120 audio_processor->PushCaptureData(*data_bus, input_capture_delay); |
121 | 121 |
122 // |audio_processor| does nothing when the audio processing is off in | 122 // |audio_processor| does nothing when the audio processing is off in |
123 // the processor. | 123 // the processor. |
124 webrtc::AudioProcessing* ap = audio_processor->audio_processing_.get(); | 124 webrtc::AudioProcessing* ap = audio_processor->audio_processing_.get(); |
125 #if defined(OS_ANDROID) || defined(OS_IOS) | 125 #if defined(OS_ANDROID) |
126 const bool is_aec_enabled = ap && ap->echo_control_mobile()->is_enabled(); | 126 const bool is_aec_enabled = ap && ap->echo_control_mobile()->is_enabled(); |
127 // AEC should be turned off for mobiles. | 127 // AEC should be turned off for mobiles. |
128 DCHECK(!ap || !ap->echo_cancellation()->is_enabled()); | 128 DCHECK(!ap || !ap->echo_cancellation()->is_enabled()); |
129 #else | 129 #else |
130 const bool is_aec_enabled = ap && ap->echo_cancellation()->is_enabled(); | 130 const bool is_aec_enabled = ap && ap->echo_cancellation()->is_enabled(); |
131 #endif | 131 #endif |
132 if (is_aec_enabled) { | 132 if (is_aec_enabled) { |
133 if (params.channels() > kMaxNumberOfPlayoutDataChannels) { | 133 if (params.channels() > kMaxNumberOfPlayoutDataChannels) { |
134 for (int i = 0; i < kMaxNumberOfPlayoutDataChannels; ++i) { | 134 for (int i = 0; i < kMaxNumberOfPlayoutDataChannels; ++i) { |
135 data_bus_playout->SetChannelData( | 135 data_bus_playout->SetChannelData( |
(...skipping 26 matching lines...) Expand all Loading... |
162 } | 162 } |
163 | 163 |
164 void VerifyDefaultComponents(MediaStreamAudioProcessor* audio_processor) { | 164 void VerifyDefaultComponents(MediaStreamAudioProcessor* audio_processor) { |
165 webrtc::AudioProcessing* audio_processing = | 165 webrtc::AudioProcessing* audio_processing = |
166 audio_processor->audio_processing_.get(); | 166 audio_processor->audio_processing_.get(); |
167 #if defined(OS_ANDROID) | 167 #if defined(OS_ANDROID) |
168 EXPECT_TRUE(audio_processing->echo_control_mobile()->is_enabled()); | 168 EXPECT_TRUE(audio_processing->echo_control_mobile()->is_enabled()); |
169 EXPECT_TRUE(audio_processing->echo_control_mobile()->routing_mode() == | 169 EXPECT_TRUE(audio_processing->echo_control_mobile()->routing_mode() == |
170 webrtc::EchoControlMobile::kSpeakerphone); | 170 webrtc::EchoControlMobile::kSpeakerphone); |
171 EXPECT_FALSE(audio_processing->echo_cancellation()->is_enabled()); | 171 EXPECT_FALSE(audio_processing->echo_cancellation()->is_enabled()); |
172 #elif !defined(OS_IOS) | 172 #else |
173 EXPECT_TRUE(audio_processing->echo_cancellation()->is_enabled()); | 173 EXPECT_TRUE(audio_processing->echo_cancellation()->is_enabled()); |
174 EXPECT_TRUE(audio_processing->echo_cancellation()->suppression_level() == | 174 EXPECT_TRUE(audio_processing->echo_cancellation()->suppression_level() == |
175 webrtc::EchoCancellation::kHighSuppression); | 175 webrtc::EchoCancellation::kHighSuppression); |
176 EXPECT_TRUE(audio_processing->echo_cancellation()->are_metrics_enabled()); | 176 EXPECT_TRUE(audio_processing->echo_cancellation()->are_metrics_enabled()); |
177 EXPECT_TRUE( | 177 EXPECT_TRUE( |
178 audio_processing->echo_cancellation()->is_delay_logging_enabled()); | 178 audio_processing->echo_cancellation()->is_delay_logging_enabled()); |
179 #endif | 179 #endif |
180 | 180 |
181 EXPECT_TRUE(audio_processing->noise_suppression()->is_enabled()); | 181 EXPECT_TRUE(audio_processing->noise_suppression()->is_enabled()); |
182 EXPECT_TRUE(audio_processing->noise_suppression()->level() == | 182 EXPECT_TRUE(audio_processing->noise_suppression()->level() == |
183 webrtc::NoiseSuppression::kHigh); | 183 webrtc::NoiseSuppression::kHigh); |
184 EXPECT_TRUE(audio_processing->high_pass_filter()->is_enabled()); | 184 EXPECT_TRUE(audio_processing->high_pass_filter()->is_enabled()); |
185 EXPECT_TRUE(audio_processing->gain_control()->is_enabled()); | 185 EXPECT_TRUE(audio_processing->gain_control()->is_enabled()); |
186 #if defined(OS_ANDROID) || defined(OS_IOS) | 186 #if defined(OS_ANDROID) |
187 EXPECT_TRUE(audio_processing->gain_control()->mode() == | 187 EXPECT_TRUE(audio_processing->gain_control()->mode() == |
188 webrtc::GainControl::kFixedDigital); | 188 webrtc::GainControl::kFixedDigital); |
189 EXPECT_FALSE(audio_processing->voice_detection()->is_enabled()); | 189 EXPECT_FALSE(audio_processing->voice_detection()->is_enabled()); |
190 #else | 190 #else |
191 EXPECT_TRUE(audio_processing->gain_control()->mode() == | 191 EXPECT_TRUE(audio_processing->gain_control()->mode() == |
192 webrtc::GainControl::kAdaptiveAnalog); | 192 webrtc::GainControl::kAdaptiveAnalog); |
193 EXPECT_TRUE(audio_processing->voice_detection()->is_enabled()); | 193 EXPECT_TRUE(audio_processing->voice_detection()->is_enabled()); |
194 EXPECT_TRUE(audio_processing->voice_detection()->likelihood() == | 194 EXPECT_TRUE(audio_processing->voice_detection()->likelihood() == |
195 webrtc::VoiceDetection::kVeryLowLikelihood); | 195 webrtc::VoiceDetection::kVeryLowLikelihood); |
196 #endif | 196 #endif |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 ProcessDataAndVerifyFormat(audio_processor.get(), | 550 ProcessDataAndVerifyFormat(audio_processor.get(), |
551 kAudioProcessingSampleRate, | 551 kAudioProcessingSampleRate, |
552 kAudioProcessingNumberOfChannel, | 552 kAudioProcessingNumberOfChannel, |
553 kAudioProcessingSampleRate / 100); | 553 kAudioProcessingSampleRate / 100); |
554 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives | 554 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
555 // |audio_processor|. | 555 // |audio_processor|. |
556 audio_processor = NULL; | 556 audio_processor = NULL; |
557 } | 557 } |
558 | 558 |
559 } // namespace content | 559 } // namespace content |
OLD | NEW |