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.h" | 5 #include "content/renderer/media/media_stream_audio_processor.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 DCHECK(processed_data); | 289 DCHECK(processed_data); |
290 DCHECK(capture_delay); | 290 DCHECK(capture_delay); |
291 DCHECK(new_volume); | 291 DCHECK(new_volume); |
292 | 292 |
293 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::ProcessAndConsumeData"); | 293 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::ProcessAndConsumeData"); |
294 | 294 |
295 MediaStreamAudioBus* process_bus; | 295 MediaStreamAudioBus* process_bus; |
296 if (!capture_fifo_->Consume(&process_bus, capture_delay)) | 296 if (!capture_fifo_->Consume(&process_bus, capture_delay)) |
297 return false; | 297 return false; |
298 | 298 |
| 299 // Detect bit-exact repetition of audio present in the captured audio. |
| 300 // We detect only one channel. |
| 301 audio_repetition_detector_.Detect(process_bus->bus()->channel(0), |
| 302 process_bus->bus()->frames(), |
| 303 1, // number of channels |
| 304 input_format_.sample_rate()); |
| 305 |
299 // Use the process bus directly if audio processing is disabled. | 306 // Use the process bus directly if audio processing is disabled. |
300 MediaStreamAudioBus* output_bus = process_bus; | 307 MediaStreamAudioBus* output_bus = process_bus; |
301 *new_volume = 0; | 308 *new_volume = 0; |
302 if (audio_processing_) { | 309 if (audio_processing_) { |
303 output_bus = output_bus_.get(); | 310 output_bus = output_bus_.get(); |
304 *new_volume = ProcessData(process_bus->channel_ptrs(), | 311 *new_volume = ProcessData(process_bus->channel_ptrs(), |
305 process_bus->bus()->frames(), *capture_delay, | 312 process_bus->bus()->frames(), *capture_delay, |
306 volume, key_pressed, output_bus->channel_ptrs()); | 313 volume, key_pressed, output_bus->channel_ptrs()); |
307 } | 314 } |
308 | 315 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 if (echo_information_) { | 685 if (echo_information_) { |
679 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); | 686 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); |
680 } | 687 } |
681 | 688 |
682 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 689 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
683 return (agc->stream_analog_level() == volume) ? | 690 return (agc->stream_analog_level() == volume) ? |
684 0 : agc->stream_analog_level(); | 691 0 : agc->stream_analog_level(); |
685 } | 692 } |
686 | 693 |
687 } // namespace content | 694 } // namespace content |
OLD | NEW |