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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 webrtc::VoiceDetection::kVeryLowLikelihood); | 244 webrtc::VoiceDetection::kVeryLowLikelihood); |
245 CHECK_EQ(err, 0); | 245 CHECK_EQ(err, 0); |
246 | 246 |
247 // 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. |
248 typing_detector->SetParameters(0, 0, 0, 0, 0, 100); | 248 typing_detector->SetParameters(0, 0, 0, 0, 0, 100); |
249 } | 249 } |
250 | 250 |
251 void StartEchoCancellationDump(AudioProcessing* audio_processing, | 251 void StartEchoCancellationDump(AudioProcessing* audio_processing, |
252 base::File aec_dump_file) { | 252 base::File aec_dump_file) { |
253 DCHECK(aec_dump_file.IsValid()); | 253 DCHECK(aec_dump_file.IsValid()); |
254 if (audio_processing->StartDebugRecordingForPlatformFile( | 254 |
255 aec_dump_file.TakePlatformFile())) { | 255 FILE* stream = base::FileToFILE(aec_dump_file.Pass(), "w"); |
| 256 if (!stream) { |
| 257 LOG(ERROR) << "Failed to open AEC dump file"; |
| 258 return; |
| 259 } |
| 260 |
| 261 if (audio_processing->StartDebugRecording(stream)) |
256 DLOG(ERROR) << "Fail to start AEC debug recording"; | 262 DLOG(ERROR) << "Fail to start AEC debug recording"; |
257 } | |
258 } | 263 } |
259 | 264 |
260 void StopEchoCancellationDump(AudioProcessing* audio_processing) { | 265 void StopEchoCancellationDump(AudioProcessing* audio_processing) { |
261 if (audio_processing->StopDebugRecording()) | 266 if (audio_processing->StopDebugRecording()) |
262 DLOG(ERROR) << "Fail to stop AEC debug recording"; | 267 DLOG(ERROR) << "Fail to stop AEC debug recording"; |
263 } | 268 } |
264 | 269 |
265 void EnableAutomaticGainControl(AudioProcessing* audio_processing) { | 270 void EnableAutomaticGainControl(AudioProcessing* audio_processing) { |
266 #if defined(OS_ANDROID) || defined(OS_IOS) | 271 #if defined(OS_ANDROID) || defined(OS_IOS) |
267 const webrtc::GainControl::Mode mode = webrtc::GainControl::kFixedDigital; | 272 const webrtc::GainControl::Mode mode = webrtc::GainControl::kFixedDigital; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 311 } |
307 | 312 |
308 int median = 0, std = 0; | 313 int median = 0, std = 0; |
309 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { | 314 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { |
310 stats->echo_delay_median_ms = median; | 315 stats->echo_delay_median_ms = median; |
311 stats->echo_delay_std_ms = std; | 316 stats->echo_delay_std_ms = std; |
312 } | 317 } |
313 } | 318 } |
314 | 319 |
315 } // namespace content | 320 } // namespace content |
OLD | NEW |