| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( | 155 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( |
| 156 new WebRtcAudioDeviceImpl()); | 156 new WebRtcAudioDeviceImpl()); |
| 157 scoped_refptr<MediaStreamAudioProcessor> audio_processor( | 157 scoped_refptr<MediaStreamAudioProcessor> audio_processor( |
| 158 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( | 158 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( |
| 159 params_, constraints, 0, webrtc_audio_device.get())); | 159 constraints, 0, webrtc_audio_device.get())); |
| 160 EXPECT_FALSE(audio_processor->has_audio_processing()); | 160 EXPECT_FALSE(audio_processor->has_audio_processing()); |
| 161 audio_processor->OnCaptureFormatChanged(params_); |
| 161 | 162 |
| 162 ProcessDataAndVerifyFormat(audio_processor, | 163 ProcessDataAndVerifyFormat(audio_processor, |
| 163 params_.sample_rate(), | 164 params_.sample_rate(), |
| 164 params_.channels(), | 165 params_.channels(), |
| 165 params_.sample_rate() / 100); | 166 params_.sample_rate() / 100); |
| 166 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives | 167 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
| 167 // |audio_processor|. | 168 // |audio_processor|. |
| 168 audio_processor = NULL; | 169 audio_processor = NULL; |
| 169 } | 170 } |
| 170 | 171 |
| 171 TEST_F(MediaStreamAudioProcessorTest, WithAudioProcessing) { | 172 TEST_F(MediaStreamAudioProcessorTest, WithAudioProcessing) { |
| 172 // Setup the audio processor with enabling the flag. | 173 // Setup the audio processor with enabling the flag. |
| 173 CommandLine::ForCurrentProcess()->AppendSwitch( | 174 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 174 switches::kEnableAudioTrackProcessing); | 175 switches::kEnableAudioTrackProcessing); |
| 175 blink::WebMediaConstraints constraints; | 176 blink::WebMediaConstraints constraints; |
| 176 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( | 177 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( |
| 177 new WebRtcAudioDeviceImpl()); | 178 new WebRtcAudioDeviceImpl()); |
| 178 scoped_refptr<MediaStreamAudioProcessor> audio_processor( | 179 scoped_refptr<MediaStreamAudioProcessor> audio_processor( |
| 179 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( | 180 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( |
| 180 params_, constraints, 0, webrtc_audio_device.get())); | 181 constraints, 0, webrtc_audio_device.get())); |
| 181 EXPECT_TRUE(audio_processor->has_audio_processing()); | 182 EXPECT_TRUE(audio_processor->has_audio_processing()); |
| 183 audio_processor->OnCaptureFormatChanged(params_); |
| 182 VerifyDefaultComponents(audio_processor); | 184 VerifyDefaultComponents(audio_processor); |
| 183 | 185 |
| 184 ProcessDataAndVerifyFormat(audio_processor, | 186 ProcessDataAndVerifyFormat(audio_processor, |
| 185 kAudioProcessingSampleRate, | 187 kAudioProcessingSampleRate, |
| 186 kAudioProcessingNumberOfChannel, | 188 kAudioProcessingNumberOfChannel, |
| 187 kAudioProcessingSampleRate / 100); | 189 kAudioProcessingSampleRate / 100); |
| 188 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives | 190 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
| 189 // |audio_processor|. | 191 // |audio_processor|. |
| 190 audio_processor = NULL; | 192 audio_processor = NULL; |
| 191 } | 193 } |
| 192 | 194 |
| 193 } // namespace content | 195 } // namespace content |
| OLD | NEW |