| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 webrtc::VoiceDetection::kVeryLowLikelihood); | 145 webrtc::VoiceDetection::kVeryLowLikelihood); |
| 146 #endif | 146 #endif |
| 147 } | 147 } |
| 148 | 148 |
| 149 media::AudioParameters params_; | 149 media::AudioParameters params_; |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 TEST_F(MediaStreamAudioProcessorTest, WithoutAudioProcessing) { | 152 TEST_F(MediaStreamAudioProcessorTest, WithoutAudioProcessing) { |
| 153 // Setup the audio processor without enabling the flag. | 153 // Setup the audio processor without enabling the flag. |
| 154 blink::WebMediaConstraints constraints; | 154 blink::WebMediaConstraints constraints; |
| 155 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( |
| 156 new WebRtcAudioDeviceImpl()); |
| 155 scoped_refptr<MediaStreamAudioProcessor> audio_processor( | 157 scoped_refptr<MediaStreamAudioProcessor> audio_processor( |
| 156 new MediaStreamAudioProcessor(params_, constraints, 0, NULL)); | 158 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( |
| 159 params_, constraints, 0, webrtc_audio_device.get())); |
| 157 EXPECT_FALSE(audio_processor->has_audio_processing()); | 160 EXPECT_FALSE(audio_processor->has_audio_processing()); |
| 158 | 161 |
| 159 ProcessDataAndVerifyFormat(audio_processor, | 162 ProcessDataAndVerifyFormat(audio_processor, |
| 160 params_.sample_rate(), | 163 params_.sample_rate(), |
| 161 params_.channels(), | 164 params_.channels(), |
| 162 params_.sample_rate() / 100); | 165 params_.sample_rate() / 100); |
| 166 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
| 167 // |audio_processor|. |
| 168 audio_processor = NULL; |
| 163 } | 169 } |
| 164 | 170 |
| 165 TEST_F(MediaStreamAudioProcessorTest, WithAudioProcessing) { | 171 TEST_F(MediaStreamAudioProcessorTest, WithAudioProcessing) { |
| 166 // Setup the audio processor with enabling the flag. | 172 // Setup the audio processor with enabling the flag. |
| 167 CommandLine::ForCurrentProcess()->AppendSwitch( | 173 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 168 switches::kEnableAudioTrackProcessing); | 174 switches::kEnableAudioTrackProcessing); |
| 169 blink::WebMediaConstraints constraints; | 175 blink::WebMediaConstraints constraints; |
| 176 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( |
| 177 new WebRtcAudioDeviceImpl()); |
| 170 scoped_refptr<MediaStreamAudioProcessor> audio_processor( | 178 scoped_refptr<MediaStreamAudioProcessor> audio_processor( |
| 171 new MediaStreamAudioProcessor(params_, constraints, 0, NULL)); | 179 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( |
| 180 params_, constraints, 0, webrtc_audio_device.get())); |
| 172 EXPECT_TRUE(audio_processor->has_audio_processing()); | 181 EXPECT_TRUE(audio_processor->has_audio_processing()); |
| 173 VerifyDefaultComponents(audio_processor); | 182 VerifyDefaultComponents(audio_processor); |
| 174 | 183 |
| 175 ProcessDataAndVerifyFormat(audio_processor, | 184 ProcessDataAndVerifyFormat(audio_processor, |
| 176 kAudioProcessingSampleRate, | 185 kAudioProcessingSampleRate, |
| 177 kAudioProcessingNumberOfChannel, | 186 kAudioProcessingNumberOfChannel, |
| 178 kAudioProcessingSampleRate / 100); | 187 kAudioProcessingSampleRate / 100); |
| 188 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
| 189 // |audio_processor|. |
| 190 audio_processor = NULL; |
| 179 } | 191 } |
| 180 | 192 |
| 181 } // namespace content | 193 } // namespace content |
| OLD | NEW |