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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 for (int time = kMaxLookbackTimeMs; time >= kMinLookbackTimeMs; | 295 for (int time = kMaxLookbackTimeMs; time >= kMinLookbackTimeMs; |
296 time -= kLookbackTimeStepMs) { | 296 time -= kLookbackTimeStepMs) { |
297 look_back_times.push_back(time); | 297 look_back_times.push_back(time); |
298 } | 298 } |
299 audio_repetition_detector_.reset( | 299 audio_repetition_detector_.reset( |
300 new AudioRepetitionDetector(kMinLengthMs, kMaxFrames, look_back_times, | 300 new AudioRepetitionDetector(kMinLengthMs, kMaxFrames, look_back_times, |
301 base::Bind(&ReportRepetition))); | 301 base::Bind(&ReportRepetition))); |
302 } | 302 } |
303 | 303 |
304 MediaStreamAudioProcessor::~MediaStreamAudioProcessor() { | 304 MediaStreamAudioProcessor::~MediaStreamAudioProcessor() { |
305 // TODO(miu): This class is ref-counted, shared among threads, and then | |
306 // requires itself to be destroyed on the main thread only?!?!? Fix this, and | |
307 // then remove the hack in WebRtcAudioSink::Adapter. | |
308 DCHECK(main_thread_checker_.CalledOnValidThread()); | 305 DCHECK(main_thread_checker_.CalledOnValidThread()); |
309 Stop(); | 306 Stop(); |
310 } | 307 } |
311 | 308 |
312 void MediaStreamAudioProcessor::OnCaptureFormatChanged( | 309 void MediaStreamAudioProcessor::OnCaptureFormatChanged( |
313 const media::AudioParameters& input_format) { | 310 const media::AudioParameters& input_format) { |
314 DCHECK(main_thread_checker_.CalledOnValidThread()); | 311 DCHECK(main_thread_checker_.CalledOnValidThread()); |
315 // There is no need to hold a lock here since the caller guarantees that | 312 // There is no need to hold a lock here since the caller guarantees that |
316 // there is no more PushCaptureData() and ProcessAndConsumeData() callbacks | 313 // there is no more PushCaptureData() and ProcessAndConsumeData() callbacks |
317 // on the capture thread. | 314 // on the capture thread. |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 if (echo_information_) { | 739 if (echo_information_) { |
743 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); | 740 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); |
744 } | 741 } |
745 | 742 |
746 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 743 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
747 return (agc->stream_analog_level() == volume) ? | 744 return (agc->stream_analog_level() == volume) ? |
748 0 : agc->stream_analog_level(); | 745 0 : agc->stream_analog_level(); |
749 } | 746 } |
750 | 747 |
751 } // namespace content | 748 } // namespace content |
OLD | NEW |