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/android/build_info.h" | 5 #include "base/android/build_info.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 | 591 |
592 AudioParameters GetInputStreamParameters() { | 592 AudioParameters GetInputStreamParameters() { |
593 GetDefaultInputStreamParametersOnAudioThread(); | 593 GetDefaultInputStreamParametersOnAudioThread(); |
594 | 594 |
595 // Override the platform effects setting to use the AudioRecord or OpenSLES | 595 // Override the platform effects setting to use the AudioRecord or OpenSLES |
596 // path as requested. | 596 // path as requested. |
597 int effects = GetParam() ? AudioParameters::ECHO_CANCELLER : | 597 int effects = GetParam() ? AudioParameters::ECHO_CANCELLER : |
598 AudioParameters::NO_EFFECTS; | 598 AudioParameters::NO_EFFECTS; |
599 AudioParameters params(audio_input_parameters().format(), | 599 AudioParameters params(audio_input_parameters().format(), |
600 audio_input_parameters().channel_layout(), | 600 audio_input_parameters().channel_layout(), |
601 audio_input_parameters().input_channels(), | |
602 audio_input_parameters().sample_rate(), | 601 audio_input_parameters().sample_rate(), |
603 audio_input_parameters().bits_per_sample(), | 602 audio_input_parameters().bits_per_sample(), |
604 audio_input_parameters().frames_per_buffer(), | 603 audio_input_parameters().frames_per_buffer(), |
605 effects); | 604 effects); |
606 return params; | 605 return params; |
607 } | 606 } |
608 | 607 |
609 void GetDefaultInputStreamParametersOnAudioThread() { | 608 void GetDefaultInputStreamParametersOnAudioThread() { |
610 RunOnAudioThread( | 609 RunOnAudioThread( |
611 base::Bind(&AudioAndroidInputTest::GetDefaultInputStreamParameters, | 610 base::Bind(&AudioAndroidInputTest::GetDefaultInputStreamParameters, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 } | 797 } |
799 | 798 |
800 // Start input streaming using non default input parameters and ensure that the | 799 // Start input streaming using non default input parameters and ensure that the |
801 // callback sequence is sane. The only change we make in this test is to select | 800 // callback sequence is sane. The only change we make in this test is to select |
802 // a 10ms buffer size instead of the default size. | 801 // a 10ms buffer size instead of the default size. |
803 TEST_P(AudioAndroidInputTest, | 802 TEST_P(AudioAndroidInputTest, |
804 DISABLED_StartInputStreamCallbacksNonDefaultParameters) { | 803 DISABLED_StartInputStreamCallbacksNonDefaultParameters) { |
805 AudioParameters native_params = GetInputStreamParameters(); | 804 AudioParameters native_params = GetInputStreamParameters(); |
806 AudioParameters params(native_params.format(), | 805 AudioParameters params(native_params.format(), |
807 native_params.channel_layout(), | 806 native_params.channel_layout(), |
808 native_params.input_channels(), | |
809 native_params.sample_rate(), | 807 native_params.sample_rate(), |
810 native_params.bits_per_sample(), | 808 native_params.bits_per_sample(), |
811 native_params.sample_rate() / 100, | 809 native_params.sample_rate() / 100, |
812 native_params.effects()); | 810 native_params.effects()); |
813 StartInputStreamCallbacks(params); | 811 StartInputStreamCallbacks(params); |
814 } | 812 } |
815 | 813 |
816 // Start output streaming using default output parameters and ensure that the | 814 // Start output streaming using default output parameters and ensure that the |
817 // callback sequence is sane. | 815 // callback sequence is sane. |
818 TEST_F(AudioAndroidOutputTest, StartOutputStreamCallbacks) { | 816 TEST_F(AudioAndroidOutputTest, StartOutputStreamCallbacks) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); | 967 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); |
970 printf("\n"); | 968 printf("\n"); |
971 StopAndCloseAudioOutputStreamOnAudioThread(); | 969 StopAndCloseAudioOutputStreamOnAudioThread(); |
972 StopAndCloseAudioInputStreamOnAudioThread(); | 970 StopAndCloseAudioInputStreamOnAudioThread(); |
973 } | 971 } |
974 | 972 |
975 INSTANTIATE_TEST_CASE_P(AudioAndroidInputTest, AudioAndroidInputTest, | 973 INSTANTIATE_TEST_CASE_P(AudioAndroidInputTest, AudioAndroidInputTest, |
976 testing::ValuesIn(RunAudioRecordInputPathTests())); | 974 testing::ValuesIn(RunAudioRecordInputPathTests())); |
977 | 975 |
978 } // namespace media | 976 } // namespace media |
OLD | NEW |