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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 const media::AudioParameters sink_params_; | 149 const media::AudioParameters sink_params_; |
151 | 150 |
152 // TODO(xians): consider using SincResampler to save some memcpy. | 151 // TODO(xians): consider using SincResampler to save some memcpy. |
153 // Handles mixing and resampling between input and output parameters. | 152 // Handles mixing and resampling between input and output parameters. |
154 media::AudioConverter audio_converter_; | 153 media::AudioConverter audio_converter_; |
155 scoped_ptr<media::AudioBus> audio_wrapper_; | 154 scoped_ptr<media::AudioBus> audio_wrapper_; |
156 scoped_ptr<media::AudioFifo> fifo_; | 155 scoped_ptr<media::AudioFifo> fifo_; |
157 }; | 156 }; |
158 | 157 |
159 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() { | 158 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() { |
160 const std::string group_name = | 159 return !CommandLine::ForCurrentProcess()->HasSwitch( |
161 base::FieldTrialList::FindFullName("MediaStreamAudioTrackProcessing"); | 160 switches::kDisableAudioTrackProcessing); |
162 return group_name == "Enabled" || CommandLine::ForCurrentProcess()->HasSwitch( | |
163 switches::kEnableAudioTrackProcessing); | |
164 } | 161 } |
165 | 162 |
166 MediaStreamAudioProcessor::MediaStreamAudioProcessor( | 163 MediaStreamAudioProcessor::MediaStreamAudioProcessor( |
167 const blink::WebMediaConstraints& constraints, | 164 const blink::WebMediaConstraints& constraints, |
168 int effects, | 165 int effects, |
169 WebRtcPlayoutDataSource* playout_data_source) | 166 WebRtcPlayoutDataSource* playout_data_source) |
170 : render_delay_ms_(0), | 167 : render_delay_ms_(0), |
171 playout_data_source_(playout_data_source), | 168 playout_data_source_(playout_data_source), |
172 audio_mirroring_(false), | 169 audio_mirroring_(false), |
173 typing_detected_(false) { | 170 typing_detected_(false) { |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 491 |
495 StopAecDump(); | 492 StopAecDump(); |
496 | 493 |
497 if (playout_data_source_) | 494 if (playout_data_source_) |
498 playout_data_source_->RemovePlayoutSink(this); | 495 playout_data_source_->RemovePlayoutSink(this); |
499 | 496 |
500 audio_processing_.reset(); | 497 audio_processing_.reset(); |
501 } | 498 } |
502 | 499 |
503 } // namespace content | 500 } // namespace content |
OLD | NEW |