| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/aligned_memory.h" | 10 #include "base/memory/aligned_memory.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "content/common/mojo/service_registry_impl.h" |
| 13 #include "content/public/common/media_stream_request.h" | 14 #include "content/public/common/media_stream_request.h" |
| 14 #include "content/renderer/media/media_stream_audio_processor.h" | 15 #include "content/renderer/media/media_stream_audio_processor.h" |
| 15 #include "content/renderer/media/media_stream_audio_processor_options.h" | 16 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 16 #include "content/renderer/media/mock_media_constraint_factory.h" | 17 #include "content/renderer/media/mock_media_constraint_factory.h" |
| 17 #include "media/audio/audio_parameters.h" | 18 #include "media/audio/audio_parameters.h" |
| 18 #include "media/base/audio_bus.h" | 19 #include "media/base/audio_bus.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 22 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 22 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 23 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 kAudioProcessingSampleRate, | 472 kAudioProcessingSampleRate, |
| 472 kAudioProcessingNumberOfChannel, | 473 kAudioProcessingNumberOfChannel, |
| 473 kAudioProcessingSampleRate / 100); | 474 kAudioProcessingSampleRate / 100); |
| 474 } | 475 } |
| 475 | 476 |
| 476 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| | 477 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| |
| 477 // outlives |audio_processor|. | 478 // outlives |audio_processor|. |
| 478 audio_processor = NULL; | 479 audio_processor = NULL; |
| 479 } | 480 } |
| 480 | 481 |
| 481 // Test that if we have an AEC dump message filter created, we are getting it | 482 // Test that if we have an audio debug recorder created, we are getting it |
| 482 // correctly in MSAP. Any IPC messages will be deleted since no sender in the | 483 // correctly in MSAP. Any IPC messages will be deleted since no sender in the |
| 483 // filter will be created. | 484 // filter will be created. |
| 484 TEST_F(MediaStreamAudioProcessorTest, GetAecDumpMessageFilter) { | 485 TEST_F(MediaStreamAudioProcessorTest, GetAudioDebugRecorder) { |
| 485 base::MessageLoopForUI message_loop; | 486 base::MessageLoopForUI message_loop; |
| 486 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_( | 487 ServiceRegistryImpl service_registry; |
| 487 new AecDumpMessageFilter(message_loop.task_runner(), | 488 scoped_refptr<AudioDebugRecorder> audio_debug_recorder( |
| 488 message_loop.task_runner())); | 489 new AudioDebugRecorder(&service_registry)); |
| 489 | 490 |
| 490 MockMediaConstraintFactory constraint_factory; | 491 MockMediaConstraintFactory constraint_factory; |
| 491 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( | 492 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( |
| 492 new WebRtcAudioDeviceImpl()); | 493 new WebRtcAudioDeviceImpl()); |
| 493 scoped_refptr<MediaStreamAudioProcessor> audio_processor( | 494 scoped_refptr<MediaStreamAudioProcessor> audio_processor( |
| 494 new rtc::RefCountedObject<MediaStreamAudioProcessor>( | 495 new rtc::RefCountedObject<MediaStreamAudioProcessor>( |
| 495 constraint_factory.CreateWebMediaConstraints(), input_device_params_, | 496 constraint_factory.CreateWebMediaConstraints(), input_device_params_, |
| 496 webrtc_audio_device.get())); | 497 webrtc_audio_device.get())); |
| 497 | 498 |
| 498 EXPECT_TRUE(audio_processor->aec_dump_message_filter_.get()); | 499 EXPECT_TRUE(audio_processor->audio_debug_recorder_.get()); |
| 500 EXPECT_EQ(audio_debug_recorder, audio_processor->audio_debug_recorder_); |
| 499 | 501 |
| 500 audio_processor = NULL; | 502 audio_processor = NULL; |
| 501 } | 503 } |
| 502 | 504 |
| 503 TEST_F(MediaStreamAudioProcessorTest, TestStereoAudio) { | 505 TEST_F(MediaStreamAudioProcessorTest, TestStereoAudio) { |
| 504 // Set up the correct constraints to turn off the audio processing and turn | 506 // Set up the correct constraints to turn off the audio processing and turn |
| 505 // on the stereo channels mirroring. | 507 // on the stereo channels mirroring. |
| 506 MockMediaConstraintFactory constraint_factory; | 508 MockMediaConstraintFactory constraint_factory; |
| 507 constraint_factory.AddMandatory(MediaAudioConstraints::kEchoCancellation, | 509 constraint_factory.AddMandatory(MediaAudioConstraints::kEchoCancellation, |
| 508 false); | 510 false); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 ProcessDataAndVerifyFormat(audio_processor.get(), | 590 ProcessDataAndVerifyFormat(audio_processor.get(), |
| 589 kAudioProcessingSampleRate, | 591 kAudioProcessingSampleRate, |
| 590 kAudioProcessingNumberOfChannel, | 592 kAudioProcessingNumberOfChannel, |
| 591 kAudioProcessingSampleRate / 100); | 593 kAudioProcessingSampleRate / 100); |
| 592 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives | 594 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
| 593 // |audio_processor|. | 595 // |audio_processor|. |
| 594 audio_processor = NULL; | 596 audio_processor = NULL; |
| 595 } | 597 } |
| 596 | 598 |
| 597 } // namespace content | 599 } // namespace content |
| OLD | NEW |