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