| 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/aligned_memory.h" | 8 #include "base/memory/aligned_memory.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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 webrtc::GainControl::kAdaptiveAnalog); | 174 webrtc::GainControl::kAdaptiveAnalog); |
| 175 EXPECT_TRUE(audio_processing->voice_detection()->is_enabled()); | 175 EXPECT_TRUE(audio_processing->voice_detection()->is_enabled()); |
| 176 EXPECT_TRUE(audio_processing->voice_detection()->likelihood() == | 176 EXPECT_TRUE(audio_processing->voice_detection()->likelihood() == |
| 177 webrtc::VoiceDetection::kVeryLowLikelihood); | 177 webrtc::VoiceDetection::kVeryLowLikelihood); |
| 178 #endif | 178 #endif |
| 179 } | 179 } |
| 180 | 180 |
| 181 media::AudioParameters params_; | 181 media::AudioParameters params_; |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 TEST_F(MediaStreamAudioProcessorTest, WithAudioProcessing) { | 184 // Test crashing with ASAN on Android. crbug.com/468762 |
| 185 #if defined(OS_ANDROID) && defined(ADDRESS_SANITIZER) |
| 186 #define MAYBE_WithAudioProcessing DISABLED_WithAudioProcessing |
| 187 #else |
| 188 #define MAYBE_WithAudioProcessing WithAudioProcessing |
| 189 #endif |
| 190 TEST_F(MediaStreamAudioProcessorTest, MAYBE_WithAudioProcessing) { |
| 185 MockMediaConstraintFactory constraint_factory; | 191 MockMediaConstraintFactory constraint_factory; |
| 186 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( | 192 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( |
| 187 new WebRtcAudioDeviceImpl()); | 193 new WebRtcAudioDeviceImpl()); |
| 188 scoped_refptr<MediaStreamAudioProcessor> audio_processor( | 194 scoped_refptr<MediaStreamAudioProcessor> audio_processor( |
| 189 new rtc::RefCountedObject<MediaStreamAudioProcessor>( | 195 new rtc::RefCountedObject<MediaStreamAudioProcessor>( |
| 190 constraint_factory.CreateWebMediaConstraints(), 0, | 196 constraint_factory.CreateWebMediaConstraints(), 0, |
| 191 webrtc_audio_device.get())); | 197 webrtc_audio_device.get())); |
| 192 EXPECT_TRUE(audio_processor->has_audio_processing()); | 198 EXPECT_TRUE(audio_processor->has_audio_processing()); |
| 193 audio_processor->OnCaptureFormatChanged(params_); | 199 audio_processor->OnCaptureFormatChanged(params_); |
| 194 VerifyDefaultComponents(audio_processor.get()); | 200 VerifyDefaultComponents(audio_processor.get()); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 363 |
| 358 TEST_F(MediaStreamAudioProcessorTest, ValidateConstraints) { | 364 TEST_F(MediaStreamAudioProcessorTest, ValidateConstraints) { |
| 359 MockMediaConstraintFactory constraint_factory; | 365 MockMediaConstraintFactory constraint_factory; |
| 360 const std::string dummy_constraint = "dummy"; | 366 const std::string dummy_constraint = "dummy"; |
| 361 constraint_factory.AddMandatory(dummy_constraint, true); | 367 constraint_factory.AddMandatory(dummy_constraint, true); |
| 362 MediaAudioConstraints audio_constraints( | 368 MediaAudioConstraints audio_constraints( |
| 363 constraint_factory.CreateWebMediaConstraints(), 0); | 369 constraint_factory.CreateWebMediaConstraints(), 0); |
| 364 EXPECT_FALSE(audio_constraints.IsValid()); | 370 EXPECT_FALSE(audio_constraints.IsValid()); |
| 365 } | 371 } |
| 366 | 372 |
| 367 TEST_F(MediaStreamAudioProcessorTest, TestAllSampleRates) { | 373 // Test crashing with ASAN on Android. crbug.com/468762 |
| 374 #if defined(OS_ANDROID) && defined(ADDRESS_SANITIZER) |
| 375 #define MAYBE_TestAllSampleRates DISABLED_TestAllSampleRates |
| 376 #else |
| 377 #define MAYBE_TestAllSampleRates TestAllSampleRates |
| 378 #endif |
| 379 TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestAllSampleRates) { |
| 368 MockMediaConstraintFactory constraint_factory; | 380 MockMediaConstraintFactory constraint_factory; |
| 369 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( | 381 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( |
| 370 new WebRtcAudioDeviceImpl()); | 382 new WebRtcAudioDeviceImpl()); |
| 371 scoped_refptr<MediaStreamAudioProcessor> audio_processor( | 383 scoped_refptr<MediaStreamAudioProcessor> audio_processor( |
| 372 new rtc::RefCountedObject<MediaStreamAudioProcessor>( | 384 new rtc::RefCountedObject<MediaStreamAudioProcessor>( |
| 373 constraint_factory.CreateWebMediaConstraints(), 0, | 385 constraint_factory.CreateWebMediaConstraints(), 0, |
| 374 webrtc_audio_device.get())); | 386 webrtc_audio_device.get())); |
| 375 EXPECT_TRUE(audio_processor->has_audio_processing()); | 387 EXPECT_TRUE(audio_processor->has_audio_processing()); |
| 376 | 388 |
| 377 static const int kSupportedSampleRates[] = | 389 static const int kSupportedSampleRates[] = |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 ProcessDataAndVerifyFormat(audio_processor.get(), | 512 ProcessDataAndVerifyFormat(audio_processor.get(), |
| 501 kAudioProcessingSampleRate, | 513 kAudioProcessingSampleRate, |
| 502 kAudioProcessingNumberOfChannel, | 514 kAudioProcessingNumberOfChannel, |
| 503 kAudioProcessingSampleRate / 100); | 515 kAudioProcessingSampleRate / 100); |
| 504 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives | 516 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
| 505 // |audio_processor|. | 517 // |audio_processor|. |
| 506 audio_processor = NULL; | 518 audio_processor = NULL; |
| 507 } | 519 } |
| 508 | 520 |
| 509 } // namespace content | 521 } // namespace content |
| OLD | NEW |