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 "base/metrics/field_trial.h" | |
10 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
11 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
12 #include "content/renderer/media/media_stream_audio_processor_options.h" | 11 #include "content/renderer/media/media_stream_audio_processor_options.h" |
13 #include "content/renderer/media/rtc_media_constraints.h" | 12 #include "content/renderer/media/rtc_media_constraints.h" |
14 #include "content/renderer/media/webrtc_audio_device_impl.h" | 13 #include "content/renderer/media/webrtc_audio_device_impl.h" |
15 #include "media/audio/audio_parameters.h" | 14 #include "media/audio/audio_parameters.h" |
16 #include "media/base/audio_converter.h" | 15 #include "media/base/audio_converter.h" |
17 #include "media/base/audio_fifo.h" | 16 #include "media/base/audio_fifo.h" |
18 #include "media/base/channel_layout.h" | 17 #include "media/base/channel_layout.h" |
19 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 18 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 const media::AudioParameters sink_params_; | 155 const media::AudioParameters sink_params_; |
157 | 156 |
158 // TODO(xians): consider using SincResampler to save some memcpy. | 157 // TODO(xians): consider using SincResampler to save some memcpy. |
159 // Handles mixing and resampling between input and output parameters. | 158 // Handles mixing and resampling between input and output parameters. |
160 media::AudioConverter audio_converter_; | 159 media::AudioConverter audio_converter_; |
161 scoped_ptr<media::AudioBus> audio_wrapper_; | 160 scoped_ptr<media::AudioBus> audio_wrapper_; |
162 scoped_ptr<media::AudioFifo> fifo_; | 161 scoped_ptr<media::AudioFifo> fifo_; |
163 }; | 162 }; |
164 | 163 |
165 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() { | 164 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() { |
166 const std::string group_name = | 165 return !CommandLine::ForCurrentProcess()->HasSwitch( |
167 base::FieldTrialList::FindFullName("MediaStreamAudioTrackProcessing"); | 166 switches::kDisableAudioTrackProcessing); |
168 return group_name == "Enabled" || CommandLine::ForCurrentProcess()->HasSwitch( | |
169 switches::kEnableAudioTrackProcessing); | |
170 } | 167 } |
171 | 168 |
172 MediaStreamAudioProcessor::MediaStreamAudioProcessor( | 169 MediaStreamAudioProcessor::MediaStreamAudioProcessor( |
173 const blink::WebMediaConstraints& constraints, | 170 const blink::WebMediaConstraints& constraints, |
174 int effects, | 171 int effects, |
175 WebRtcPlayoutDataSource* playout_data_source) | 172 WebRtcPlayoutDataSource* playout_data_source) |
176 : render_delay_ms_(0), | 173 : render_delay_ms_(0), |
177 playout_data_source_(playout_data_source), | 174 playout_data_source_(playout_data_source), |
178 audio_mirroring_(false), | 175 audio_mirroring_(false), |
179 typing_detected_(false) { | 176 typing_detected_(false) { |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 497 |
501 StopAecDump(); | 498 StopAecDump(); |
502 | 499 |
503 if (playout_data_source_) | 500 if (playout_data_source_) |
504 playout_data_source_->RemovePlayoutSink(this); | 501 playout_data_source_->RemovePlayoutSink(this); |
505 | 502 |
506 audio_processing_.reset(); | 503 audio_processing_.reset(); |
507 } | 504 } |
508 | 505 |
509 } // namespace content | 506 } // namespace content |
OLD | NEW |