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/files/file_path.h" | 8 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "content/common/media/media_stream_options.h" | 14 #include "content/common/media/media_stream_options.h" |
14 #include "content/renderer/media/media_stream_constraints_util.h" | 15 #include "content/renderer/media/media_stream_constraints_util.h" |
15 #include "content/renderer/media/media_stream_source.h" | 16 #include "content/renderer/media/media_stream_source.h" |
16 #include "content/renderer/media/rtc_media_constraints.h" | 17 #include "content/renderer/media/rtc_media_constraints.h" |
(...skipping 234 matching lines...) Loading... |
251 typing_detector->SetParameters(0, 0, 0, 0, 0, 100); | 252 typing_detector->SetParameters(0, 0, 0, 0, 0, 100); |
252 } | 253 } |
253 | 254 |
254 void EnableExperimentalEchoCancellation(AudioProcessing* audio_processing) { | 255 void EnableExperimentalEchoCancellation(AudioProcessing* audio_processing) { |
255 webrtc::Config config; | 256 webrtc::Config config; |
256 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); | 257 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); |
257 audio_processing->SetExtraOptions(config); | 258 audio_processing->SetExtraOptions(config); |
258 } | 259 } |
259 | 260 |
260 void StartEchoCancellationDump(AudioProcessing* audio_processing, | 261 void StartEchoCancellationDump(AudioProcessing* audio_processing, |
261 const base::PlatformFile& aec_dump_file) { | 262 base::File aec_dump_file) { |
262 DCHECK_NE(aec_dump_file, base::kInvalidPlatformFileValue); | 263 DCHECK(aec_dump_file.IsValid()); |
263 | 264 |
264 FILE* stream = base::FdopenPlatformFile(aec_dump_file, "w"); | 265 FILE* stream = base::FileToFILE(aec_dump_file.Pass(), "w"); |
265 if (!stream) { | 266 if (!stream) { |
266 LOG(ERROR) << "Failed to open AEC dump file"; | 267 LOG(ERROR) << "Failed to open AEC dump file"; |
267 return; | 268 return; |
268 } | 269 } |
269 | 270 |
270 if (audio_processing->StartDebugRecording(stream)) | 271 if (audio_processing->StartDebugRecording(stream)) |
271 DLOG(ERROR) << "Fail to start AEC debug recording"; | 272 DLOG(ERROR) << "Fail to start AEC debug recording"; |
272 } | 273 } |
273 | 274 |
274 void StopEchoCancellationDump(AudioProcessing* audio_processing) { | 275 void StopEchoCancellationDump(AudioProcessing* audio_processing) { |
(...skipping 45 matching lines...) Loading... |
320 } | 321 } |
321 | 322 |
322 int median = 0, std = 0; | 323 int median = 0, std = 0; |
323 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { | 324 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { |
324 stats->echo_delay_median_ms = median; | 325 stats->echo_delay_median_ms = median; |
325 stats->echo_delay_std_ms = std; | 326 stats->echo_delay_std_ms = std; |
326 } | 327 } |
327 } | 328 } |
328 | 329 |
329 } // namespace content | 330 } // namespace content |
OLD | NEW |