| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 TEST_F(MediaStreamAudioProcessorTest, ValidateGoodConstraints) { | 336 TEST_F(MediaStreamAudioProcessorTest, ValidateGoodConstraints) { |
| 337 MockConstraintFactory constraint_factory; | 337 MockConstraintFactory constraint_factory; |
| 338 // Check that the renderToAssociatedSink constraint is considered valid. | 338 // Check that the renderToAssociatedSink constraint is considered valid. |
| 339 constraint_factory.basic().renderToAssociatedSink.setExact(true); | 339 constraint_factory.basic().renderToAssociatedSink.setExact(true); |
| 340 MediaAudioConstraints audio_constraints( | 340 MediaAudioConstraints audio_constraints( |
| 341 constraint_factory.CreateWebMediaConstraints(), 0); | 341 constraint_factory.CreateWebMediaConstraints(), 0); |
| 342 EXPECT_TRUE(audio_constraints.IsValid()); | 342 EXPECT_TRUE(audio_constraints.IsValid()); |
| 343 } | 343 } |
| 344 | 344 |
| 345 TEST_F(MediaStreamAudioProcessorTest, NoEchoTurnsOffProcessing) { |
| 346 { |
| 347 MockConstraintFactory constraint_factory; |
| 348 MediaAudioConstraints audio_constraints( |
| 349 constraint_factory.CreateWebMediaConstraints(), 0); |
| 350 // The default value for echo cancellation is true, except when all |
| 351 // audio processing has been turned off. |
| 352 EXPECT_TRUE(audio_constraints.default_audio_processing_constraint_value()); |
| 353 } |
| 354 // Turning off audio processing via a mandatory constraint. |
| 355 { |
| 356 MockConstraintFactory constraint_factory; |
| 357 constraint_factory.basic().echoCancellation.setExact(false); |
| 358 MediaAudioConstraints audio_constraints( |
| 359 constraint_factory.CreateWebMediaConstraints(), 0); |
| 360 // The default value for echo cancellation is true, except when all |
| 361 // audio processing has been turned off. |
| 362 EXPECT_FALSE(audio_constraints.default_audio_processing_constraint_value()); |
| 363 } |
| 364 // Turning off audio processing via an optional constraint. |
| 365 { |
| 366 MockConstraintFactory constraint_factory; |
| 367 constraint_factory.AddAdvanced().echoCancellation.setExact(false); |
| 368 MediaAudioConstraints audio_constraints( |
| 369 constraint_factory.CreateWebMediaConstraints(), 0); |
| 370 EXPECT_FALSE(audio_constraints.default_audio_processing_constraint_value()); |
| 371 } |
| 372 } |
| 373 |
| 345 MediaAudioConstraints MakeMediaAudioConstraints( | 374 MediaAudioConstraints MakeMediaAudioConstraints( |
| 346 const MockConstraintFactory& constraint_factory) { | 375 const MockConstraintFactory& constraint_factory) { |
| 347 return MediaAudioConstraints(constraint_factory.CreateWebMediaConstraints(), | 376 return MediaAudioConstraints(constraint_factory.CreateWebMediaConstraints(), |
| 348 AudioParameters::NO_EFFECTS); | 377 AudioParameters::NO_EFFECTS); |
| 349 } | 378 } |
| 350 | 379 |
| 351 TEST_F(MediaStreamAudioProcessorTest, SelectsConstraintsArrayGeometryIfExists) { | 380 TEST_F(MediaStreamAudioProcessorTest, SelectsConstraintsArrayGeometryIfExists) { |
| 352 std::vector<webrtc::Point> constraints_geometry(1, | 381 std::vector<webrtc::Point> constraints_geometry(1, |
| 353 webrtc::Point(-0.02f, 0, 0)); | 382 webrtc::Point(-0.02f, 0, 0)); |
| 354 constraints_geometry.push_back(webrtc::Point(0.02f, 0, 0)); | 383 constraints_geometry.push_back(webrtc::Point(0.02f, 0, 0)); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 ProcessDataAndVerifyFormat(audio_processor.get(), | 579 ProcessDataAndVerifyFormat(audio_processor.get(), |
| 551 kAudioProcessingSampleRate, | 580 kAudioProcessingSampleRate, |
| 552 kAudioProcessingNumberOfChannel, | 581 kAudioProcessingNumberOfChannel, |
| 553 kAudioProcessingSampleRate / 100); | 582 kAudioProcessingSampleRate / 100); |
| 554 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives | 583 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
| 555 // |audio_processor|. | 584 // |audio_processor|. |
| 556 audio_processor = NULL; | 585 audio_processor = NULL; |
| 557 } | 586 } |
| 558 | 587 |
| 559 } // namespace content | 588 } // namespace content |
| OLD | NEW |