| 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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 10 #include "content/renderer/media/media_stream_audio_processor_options.h" | 10 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 const media::AudioParameters& MediaStreamAudioProcessor::InputFormat() const { | 183 const media::AudioParameters& MediaStreamAudioProcessor::InputFormat() const { |
| 184 return capture_converter_->source_parameters(); | 184 return capture_converter_->source_parameters(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 const media::AudioParameters& MediaStreamAudioProcessor::OutputFormat() const { | 187 const media::AudioParameters& MediaStreamAudioProcessor::OutputFormat() const { |
| 188 return capture_converter_->sink_parameters(); | 188 return capture_converter_->sink_parameters(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void MediaStreamAudioProcessor::StartAecDump( |
| 192 const base::PlatformFile& aec_dump_file) { |
| 193 if (audio_processing_) |
| 194 StartEchoCancellationDump(audio_processing_.get(), aec_dump_file); |
| 195 } |
| 196 |
| 197 void MediaStreamAudioProcessor::StopAecDump() { |
| 198 if (audio_processing_) |
| 199 StopEchoCancellationDump(audio_processing_.get()); |
| 200 } |
| 201 |
| 191 void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus, | 202 void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus, |
| 192 int sample_rate, | 203 int sample_rate, |
| 193 int audio_delay_milliseconds) { | 204 int audio_delay_milliseconds) { |
| 194 DCHECK(render_thread_checker_.CalledOnValidThread()); | 205 DCHECK(render_thread_checker_.CalledOnValidThread()); |
| 195 #if defined(OS_ANDROID) || defined(OS_IOS) | 206 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 196 DCHECK(audio_processing_->echo_control_mobile()->is_enabled()); | 207 DCHECK(audio_processing_->echo_control_mobile()->is_enabled()); |
| 197 #else | 208 #else |
| 198 DCHECK(audio_processing_->echo_cancellation()->is_enabled()); | 209 DCHECK(audio_processing_->echo_cancellation()->is_enabled()); |
| 199 #endif | 210 #endif |
| 200 | 211 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // Return 0 if the volume has not been changed, otherwise return the new | 434 // Return 0 if the volume has not been changed, otherwise return the new |
| 424 // volume. | 435 // volume. |
| 425 return (agc->stream_analog_level() == volume) ? | 436 return (agc->stream_analog_level() == volume) ? |
| 426 0 : agc->stream_analog_level(); | 437 0 : agc->stream_analog_level(); |
| 427 } | 438 } |
| 428 | 439 |
| 429 void MediaStreamAudioProcessor::StopAudioProcessing() { | 440 void MediaStreamAudioProcessor::StopAudioProcessing() { |
| 430 if (!audio_processing_.get()) | 441 if (!audio_processing_.get()) |
| 431 return; | 442 return; |
| 432 | 443 |
| 444 StopAecDump(); |
| 445 |
| 433 if (playout_data_source_) | 446 if (playout_data_source_) |
| 434 playout_data_source_->RemovePlayoutSink(this); | 447 playout_data_source_->RemovePlayoutSink(this); |
| 435 | 448 |
| 436 audio_processing_.reset(); | 449 audio_processing_.reset(); |
| 437 } | 450 } |
| 438 | 451 |
| 439 } // namespace content | 452 } // namespace content |
| OLD | NEW |