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 "content/renderer/media/media_stream_audio_processor_options.h" | 5 #include "content/renderer/media/media_stream_audio_processor_options.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 CHECK_EQ(err, 0); | 226 CHECK_EQ(err, 0); |
227 } | 227 } |
228 | 228 |
229 void EnableNoiseSuppression(AudioProcessing* audio_processing) { | 229 void EnableNoiseSuppression(AudioProcessing* audio_processing) { |
230 int err = audio_processing->noise_suppression()->set_level( | 230 int err = audio_processing->noise_suppression()->set_level( |
231 webrtc::NoiseSuppression::kHigh); | 231 webrtc::NoiseSuppression::kHigh); |
232 err |= audio_processing->noise_suppression()->Enable(true); | 232 err |= audio_processing->noise_suppression()->Enable(true); |
233 CHECK_EQ(err, 0); | 233 CHECK_EQ(err, 0); |
234 } | 234 } |
235 | 235 |
236 void EnableExperimentalNoiseSuppression(AudioProcessing* audio_processing) { | |
237 webrtc::Config config; | |
238 config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(true)); | |
239 audio_processing->SetExtraOptions(config); | |
240 } | |
241 | |
242 void EnableHighPassFilter(AudioProcessing* audio_processing) { | 236 void EnableHighPassFilter(AudioProcessing* audio_processing) { |
243 CHECK_EQ(audio_processing->high_pass_filter()->Enable(true), 0); | 237 CHECK_EQ(audio_processing->high_pass_filter()->Enable(true), 0); |
244 } | 238 } |
245 | 239 |
246 void EnableTypingDetection(AudioProcessing* audio_processing, | 240 void EnableTypingDetection(AudioProcessing* audio_processing, |
247 webrtc::TypingDetection* typing_detector) { | 241 webrtc::TypingDetection* typing_detector) { |
248 int err = audio_processing->voice_detection()->Enable(true); | 242 int err = audio_processing->voice_detection()->Enable(true); |
249 err |= audio_processing->voice_detection()->set_likelihood( | 243 err |= audio_processing->voice_detection()->set_likelihood( |
250 webrtc::VoiceDetection::kVeryLowLikelihood); | 244 webrtc::VoiceDetection::kVeryLowLikelihood); |
251 CHECK_EQ(err, 0); | 245 CHECK_EQ(err, 0); |
252 | 246 |
253 // Configure the update period to 1s (100 * 10ms) in the typing detector. | 247 // Configure the update period to 1s (100 * 10ms) in the typing detector. |
254 typing_detector->SetParameters(0, 0, 0, 0, 0, 100); | 248 typing_detector->SetParameters(0, 0, 0, 0, 0, 100); |
255 } | 249 } |
256 | 250 |
257 void EnableExperimentalEchoCancellation(AudioProcessing* audio_processing) { | |
258 webrtc::Config config; | |
259 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); | |
260 audio_processing->SetExtraOptions(config); | |
261 } | |
262 | |
263 void StartEchoCancellationDump(AudioProcessing* audio_processing, | 251 void StartEchoCancellationDump(AudioProcessing* audio_processing, |
264 base::File aec_dump_file) { | 252 base::File aec_dump_file) { |
265 DCHECK(aec_dump_file.IsValid()); | 253 DCHECK(aec_dump_file.IsValid()); |
266 | 254 |
267 FILE* stream = base::FileToFILE(aec_dump_file.Pass(), "w"); | 255 FILE* stream = base::FileToFILE(aec_dump_file.Pass(), "w"); |
268 if (!stream) { | 256 if (!stream) { |
269 LOG(ERROR) << "Failed to open AEC dump file"; | 257 LOG(ERROR) << "Failed to open AEC dump file"; |
270 return; | 258 return; |
271 } | 259 } |
272 | 260 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 311 } |
324 | 312 |
325 int median = 0, std = 0; | 313 int median = 0, std = 0; |
326 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { | 314 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { |
327 stats->echo_delay_median_ms = median; | 315 stats->echo_delay_median_ms = median; |
328 stats->echo_delay_std_ms = std; | 316 stats->echo_delay_std_ms = std; |
329 } | 317 } |
330 } | 318 } |
331 | 319 |
332 } // namespace content | 320 } // namespace content |
OLD | NEW |