Chromium Code Reviews| 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" |
| 11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 12 #include "content/renderer/media/media_stream_audio_processor_options.h" | 12 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 13 #include "content/renderer/media/rtc_media_constraints.h" | 13 #include "content/renderer/media/rtc_media_constraints.h" |
| 14 #include "content/renderer/media/webrtc_audio_device_impl.h" | 14 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 15 #include "media/audio/audio_parameters.h" | 15 #include "media/audio/audio_parameters.h" |
| 16 #include "media/base/audio_converter.h" | 16 #include "media/base/audio_converter.h" |
| 17 #include "media/base/audio_fifo.h" | 17 #include "media/base/audio_fifo.h" |
| 18 #include "media/base/channel_layout.h" | 18 #include "media/base/channel_layout.h" |
| 19 #include "media/base/limits.h" | |
| 19 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 20 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 20 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h" | 21 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h" |
| 21 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" | 22 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 using webrtc::AudioProcessing; | 28 using webrtc::AudioProcessing; |
| 28 using webrtc::NoiseSuppression; | 29 using webrtc::NoiseSuppression; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 int source_frames, | 131 int source_frames, |
| 131 int destination_frames, | 132 int destination_frames, |
| 132 int sample_rate) | 133 int sample_rate) |
| 133 : source_channels_(source_channels), | 134 : source_channels_(source_channels), |
| 134 source_frames_(source_frames), | 135 source_frames_(source_frames), |
| 135 sample_rate_(sample_rate), | 136 sample_rate_(sample_rate), |
| 136 destination_( | 137 destination_( |
| 137 new MediaStreamAudioBus(destination_channels, destination_frames)), | 138 new MediaStreamAudioBus(destination_channels, destination_frames)), |
| 138 data_available_(false) { | 139 data_available_(false) { |
| 139 DCHECK_GE(source_channels, destination_channels); | 140 DCHECK_GE(source_channels, destination_channels); |
| 140 DCHECK_GT(sample_rate_, 0); | 141 DCHECK_GE(sample_rate_, media::limits::kMinSampleRate); |
|
Henrik Grunell
2015/09/30 08:19:25
I was thinking to test the set of explicit samples
henrika (OOO until Aug 14)
2015/09/30 08:49:18
Have not done the latest changes in this area and
| |
| 142 DCHECK_LE(sample_rate_, media::limits::kMaxSampleRate); | |
| 141 | 143 |
| 142 if (source_channels > destination_channels) { | 144 if (source_channels > destination_channels) { |
| 143 audio_source_intermediate_ = | 145 audio_source_intermediate_ = |
| 144 media::AudioBus::CreateWrapper(destination_channels); | 146 media::AudioBus::CreateWrapper(destination_channels); |
| 145 } | 147 } |
| 146 | 148 |
| 147 if (source_frames != destination_frames) { | 149 if (source_frames != destination_frames) { |
| 148 // Since we require every Push to be followed by as many Consumes as | 150 // Since we require every Push to be followed by as many Consumes as |
| 149 // possible, twice the larger of the two is a (probably) loose upper bound | 151 // possible, twice the larger of the two is a (probably) loose upper bound |
| 150 // on the FIFO size. | 152 // on the FIFO size. |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 if (echo_information_) { | 680 if (echo_information_) { |
| 679 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); | 681 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); |
| 680 } | 682 } |
| 681 | 683 |
| 682 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 684 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
| 683 return (agc->stream_analog_level() == volume) ? | 685 return (agc->stream_analog_level() == volume) ? |
| 684 0 : agc->stream_analog_level(); | 686 0 : agc->stream_analog_level(); |
| 685 } | 687 } |
| 686 | 688 |
| 687 } // namespace content | 689 } // namespace content |
| OLD | NEW |