Chromium Code Reviews| Index: content/renderer/media/media_stream_audio_processor.cc |
| diff --git a/content/renderer/media/media_stream_audio_processor.cc b/content/renderer/media/media_stream_audio_processor.cc |
| index 720afbf5e54306e641eb207f1d6d0616410599b5..046f294a98f7fd5f9404aab9d6fab1fb2392261a 100644 |
| --- a/content/renderer/media/media_stream_audio_processor.cc |
| +++ b/content/renderer/media/media_stream_audio_processor.cc |
| @@ -140,7 +140,6 @@ class MediaStreamAudioProcessor::MediaStreamAudioConverter |
| }; |
| MediaStreamAudioProcessor::MediaStreamAudioProcessor( |
| - const media::AudioParameters& source_params, |
| const blink::WebMediaConstraints& constraints, |
| int effects, |
| WebRtcPlayoutDataSource* playout_data_source) |
| @@ -151,7 +150,6 @@ MediaStreamAudioProcessor::MediaStreamAudioProcessor( |
| capture_thread_checker_.DetachFromThread(); |
| render_thread_checker_.DetachFromThread(); |
| InitializeAudioProcessingModule(constraints, effects); |
| - InitializeCaptureConverter(source_params); |
| } |
| MediaStreamAudioProcessor::~MediaStreamAudioProcessor() { |
| @@ -159,8 +157,26 @@ MediaStreamAudioProcessor::~MediaStreamAudioProcessor() { |
| StopAudioProcessing(); |
| } |
| +void MediaStreamAudioProcessor::OnCaptureFormatChanged( |
| + const media::AudioParameters& source_params) { |
| + DCHECK(main_thread_checker_.CalledOnValidThread()); |
| + // There is no need to hold a lock here since the caller guarantees that |
| + // there is no more PushCaptureData() and ProcessAndConsumeData() callbacks |
| + // on the capture thread. |
| + InitializeCaptureConverter(source_params); |
|
Henrik Grunell
2014/03/07 09:14:57
Is InitializeCaptureConverter() OK to call multipl
no longer working on chromium
2014/03/07 10:14:54
Yes.
|
| + |
| + // Reset the |capture_thread_checker_| since the capture data will come from |
| + // a new capture thread. |
| + capture_thread_checker_.DetachFromThread(); |
| +} |
| + |
| void MediaStreamAudioProcessor::PushCaptureData(media::AudioBus* audio_source) { |
| DCHECK(capture_thread_checker_.CalledOnValidThread()); |
| + DCHECK_EQ(audio_source->channels(), |
| + capture_converter_->source_parameters().channels()); |
| + DCHECK_EQ(audio_source->frames(), |
| + capture_converter_->source_parameters().frames_per_buffer()); |
| + |
| if (audio_mirroring_ && |
| capture_converter_->source_parameters().channel_layout() == |
| media::CHANNEL_LAYOUT_STEREO) { |
| @@ -195,6 +211,17 @@ const media::AudioParameters& MediaStreamAudioProcessor::OutputFormat() const { |
| return capture_converter_->sink_parameters(); |
| } |
| +void MediaStreamAudioProcessor::StartAecDump( |
| + const base::PlatformFile& aec_dump_file) { |
| + if (audio_processing_) |
| + StartEchoCancellationDump(audio_processing_.get(), aec_dump_file); |
| +} |
| + |
| +void MediaStreamAudioProcessor::StopAecDump() { |
| + if (audio_processing_) |
| + StopEchoCancellationDump(audio_processing_.get()); |
| +} |
| + |
| void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus, |
| int sample_rate, |
| int audio_delay_milliseconds) { |
| @@ -326,6 +353,7 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| void MediaStreamAudioProcessor::InitializeCaptureConverter( |
| const media::AudioParameters& source_params) { |
| + DCHECK(main_thread_checker_.CalledOnValidThread()); |
| DCHECK(source_params.IsValid()); |
| // Create and initialize audio converter for the source data. |
| @@ -439,6 +467,8 @@ void MediaStreamAudioProcessor::StopAudioProcessing() { |
| if (!audio_processing_.get()) |
| return; |
| + StopAecDump(); |
|
Henrik Grunell
2014/03/07 09:14:57
This shouldn't be necessary, it will be stopped wh
no longer working on chromium
2014/03/07 10:14:54
As discussed offline, lets keep this.
|
| + |
| if (playout_data_source_) |
| playout_data_source_->RemovePlayoutSink(this); |