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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 | 511 |
512 double average_time_between_callbacks_ms = | 512 double average_time_between_callbacks_ms = |
513 AverageTimeBetweenCallbacks(num_callbacks); | 513 AverageTimeBetweenCallbacks(num_callbacks); |
514 VLOG(0) << "expected time between callbacks: " | 514 VLOG(0) << "expected time between callbacks: " |
515 << expected_time_between_callbacks_ms << " ms"; | 515 << expected_time_between_callbacks_ms << " ms"; |
516 VLOG(0) << "average time between callbacks: " | 516 VLOG(0) << "average time between callbacks: " |
517 << average_time_between_callbacks_ms << " ms"; | 517 << average_time_between_callbacks_ms << " ms"; |
518 EXPECT_GE(average_time_between_callbacks_ms, | 518 EXPECT_GE(average_time_between_callbacks_ms, |
519 0.70 * expected_time_between_callbacks_ms); | 519 0.70 * expected_time_between_callbacks_ms); |
520 EXPECT_LE(average_time_between_callbacks_ms, | 520 EXPECT_LE(average_time_between_callbacks_ms, |
521 1.35 * expected_time_between_callbacks_ms); | 521 1.50 * expected_time_between_callbacks_ms); |
522 } | 522 } |
523 | 523 |
524 void GetDefaultOutputStreamParameters() { | 524 void GetDefaultOutputStreamParameters() { |
525 DCHECK(audio_manager()->GetTaskRunner()->BelongsToCurrentThread()); | 525 DCHECK(audio_manager()->GetTaskRunner()->BelongsToCurrentThread()); |
526 audio_output_parameters_ = | 526 audio_output_parameters_ = |
527 audio_manager()->GetDefaultOutputStreamParameters(); | 527 audio_manager()->GetDefaultOutputStreamParameters(); |
528 EXPECT_TRUE(audio_output_parameters_.IsValid()); | 528 EXPECT_TRUE(audio_output_parameters_.IsValid()); |
529 } | 529 } |
530 | 530 |
531 void MakeOutputStream(const AudioParameters& params) { | 531 void MakeOutputStream(const AudioParameters& params) { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
818 TEST_F(AudioAndroidOutputTest, StartOutputStreamCallbacks) { | 818 TEST_F(AudioAndroidOutputTest, StartOutputStreamCallbacks) { |
819 GetDefaultOutputStreamParametersOnAudioThread(); | 819 GetDefaultOutputStreamParametersOnAudioThread(); |
820 StartOutputStreamCallbacks(audio_output_parameters()); | 820 StartOutputStreamCallbacks(audio_output_parameters()); |
821 } | 821 } |
822 | 822 |
823 // Start output streaming using non default output parameters and ensure that | 823 // Start output streaming using non default output parameters and ensure that |
824 // the callback sequence is sane. The only change we make in this test is to | 824 // the callback sequence is sane. The only change we make in this test is to |
825 // select a 10ms buffer size instead of the default size and to open up the | 825 // select a 10ms buffer size instead of the default size and to open up the |
826 // device in mono. | 826 // device in mono. |
827 // TODO(henrika): possibly add support for more variations. | 827 // TODO(henrika): possibly add support for more variations. |
828 TEST_F(AudioAndroidOutputTest, DISABLED_StartOutputStreamCallbacksNonDefaultPara meters) { | 828 TEST_F(AudioAndroidOutputTest, |
829 StartOutputStreamCallbacksNonDefaultParameters) { | |
tommi (sloooow) - chröme
2014/08/12 08:20:55
nit: fits in one line (I think)
henrika (OOO until Aug 14)
2014/08/12 08:37:44
It did ;-)
| |
829 GetDefaultOutputStreamParametersOnAudioThread(); | 830 GetDefaultOutputStreamParametersOnAudioThread(); |
830 AudioParameters params(audio_output_parameters().format(), | 831 AudioParameters params(audio_output_parameters().format(), |
831 CHANNEL_LAYOUT_MONO, | 832 CHANNEL_LAYOUT_MONO, |
832 audio_output_parameters().sample_rate(), | 833 audio_output_parameters().sample_rate(), |
833 audio_output_parameters().bits_per_sample(), | 834 audio_output_parameters().bits_per_sample(), |
834 audio_output_parameters().sample_rate() / 100); | 835 audio_output_parameters().sample_rate() / 100); |
835 StartOutputStreamCallbacks(params); | 836 StartOutputStreamCallbacks(params); |
836 } | 837 } |
837 | 838 |
838 // Play out a PCM file segment in real time and allow the user to verify that | 839 // Play out a PCM file segment in real time and allow the user to verify that |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
969 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); | 970 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); |
970 printf("\n"); | 971 printf("\n"); |
971 StopAndCloseAudioOutputStreamOnAudioThread(); | 972 StopAndCloseAudioOutputStreamOnAudioThread(); |
972 StopAndCloseAudioInputStreamOnAudioThread(); | 973 StopAndCloseAudioInputStreamOnAudioThread(); |
973 } | 974 } |
974 | 975 |
975 INSTANTIATE_TEST_CASE_P(AudioAndroidInputTest, AudioAndroidInputTest, | 976 INSTANTIATE_TEST_CASE_P(AudioAndroidInputTest, AudioAndroidInputTest, |
976 testing::ValuesIn(RunAudioRecordInputPathTests())); | 977 testing::ValuesIn(RunAudioRecordInputPathTests())); |
977 | 978 |
978 } // namespace media | 979 } // namespace media |
OLD | NEW |