OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/environment.h" | 6 #include "base/environment.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.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "media/audio/mac/audio_manager_mac.h" | 22 #include "media/audio/mac/audio_manager_mac.h" |
23 #elif defined(OS_WIN) | 23 #elif defined(OS_WIN) |
24 #include "media/audio/win/audio_manager_win.h" | 24 #include "media/audio/win/audio_manager_win.h" |
25 #elif defined(OS_ANDROID) | 25 #elif defined(OS_ANDROID) |
26 #include "media/audio/android/audio_manager_android.h" | 26 #include "media/audio/android/audio_manager_android.h" |
27 #endif | 27 #endif |
28 #include "media/base/seekable_buffer.h" | 28 #include "media/base/seekable_buffer.h" |
29 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
31 | 31 |
32 using base::win::ScopedCOMInitializer; | |
33 | |
34 namespace media { | |
35 | |
36 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 32 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
37 typedef AudioManagerLinux AudioManagerAnyPlatform; | 33 typedef AudioManagerLinux AudioManagerAnyPlatform; |
38 #elif defined(OS_MACOSX) | 34 #elif defined(OS_MACOSX) |
39 typedef AudioManagerMac AudioManagerAnyPlatform; | 35 typedef AudioManagerMac AudioManagerAnyPlatform; |
40 #elif defined(OS_WIN) | 36 #elif defined(OS_WIN) |
41 typedef AudioManagerWin AudioManagerAnyPlatform; | 37 typedef AudioManagerWin AudioManagerAnyPlatform; |
42 #elif defined(OS_ANDROID) | 38 #elif defined(OS_ANDROID) |
43 typedef AudioManagerAndroid AudioManagerAnyPlatform; | 39 typedef AudioManagerAndroid AudioManagerAnyPlatform; |
44 #endif | 40 #endif |
45 | 41 |
| 42 using base::win::ScopedCOMInitializer; |
| 43 |
| 44 namespace { |
46 // Limits the number of delay measurements we can store in an array and | 45 // Limits the number of delay measurements we can store in an array and |
47 // then write to file at end of the WASAPIAudioInputOutputFullDuplex test. | 46 // then write to file at end of the WASAPIAudioInputOutputFullDuplex test. |
48 static const size_t kMaxDelayMeasurements = 1000; | 47 static const size_t kMaxDelayMeasurements = 1000; |
49 | 48 |
50 // Name of the output text file. The output file will be stored in the | 49 // Name of the output text file. The output file will be stored in the |
51 // directory containing media_unittests.exe. | 50 // directory containing media_unittests.exe. |
52 // Example: \src\build\Debug\audio_delay_values_ms.txt. | 51 // Example: \src\build\Debug\audio_delay_values_ms.txt. |
53 // See comments for the WASAPIAudioInputOutputFullDuplex test for more details | 52 // See comments for the WASAPIAudioInputOutputFullDuplex test for more details |
54 // about the file format. | 53 // about the file format. |
55 static const char* kDelayValuesFileName = "audio_delay_values_ms.txt"; | 54 static const char* kDelayValuesFileName = "audio_delay_values_ms.txt"; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return input && output; | 115 return input && output; |
117 } | 116 } |
118 | 117 |
119 private: | 118 private: |
120 MessageLoopForUI message_loop_; | 119 MessageLoopForUI message_loop_; |
121 MockAudioManager mock_audio_manager_; | 120 MockAudioManager mock_audio_manager_; |
122 | 121 |
123 DISALLOW_COPY_AND_ASSIGN(AudioLowLatencyInputOutputTest); | 122 DISALLOW_COPY_AND_ASSIGN(AudioLowLatencyInputOutputTest); |
124 }; | 123 }; |
125 | 124 |
| 125 } // namespace |
| 126 |
126 // This audio source/sink implementation should be used for manual tests | 127 // This audio source/sink implementation should be used for manual tests |
127 // only since delay measurements are stored on an output text file. | 128 // only since delay measurements are stored on an output text file. |
128 // All incoming/recorded audio packets are stored in an intermediate media | 129 // All incoming/recorded audio packets are stored in an intermediate media |
129 // buffer which the renderer reads from when it needs audio for playout. | 130 // buffer which the renderer reads from when it needs audio for playout. |
130 // The total effect is that recorded audio is played out in loop back using | 131 // The total effect is that recorded audio is played out in loop back using |
131 // a sync buffer as temporary storage. | 132 // a sync buffer as temporary storage. |
132 class FullDuplexAudioSinkSource | 133 class FullDuplexAudioSinkSource |
133 | 134 |
134 : public AudioInputStream::AudioInputCallback, | 135 : public AudioInputStream::AudioInputCallback, |
135 public AudioOutputStream::AudioSourceCallback { | 136 public AudioOutputStream::AudioSourceCallback { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 aos->Stop(); | 456 aos->Stop(); |
456 ais->Stop(); | 457 ais->Stop(); |
457 | 458 |
458 // All Close() operations that run on the mocked audio thread, | 459 // All Close() operations that run on the mocked audio thread, |
459 // should be synchronous and not post additional close tasks to | 460 // should be synchronous and not post additional close tasks to |
460 // mocked the audio thread. Hence, there is no need to call | 461 // mocked the audio thread. Hence, there is no need to call |
461 // message_loop()->RunAllPending() after the Close() methods. | 462 // message_loop()->RunAllPending() after the Close() methods. |
462 aos->Close(); | 463 aos->Close(); |
463 ais->Close(); | 464 ais->Close(); |
464 } | 465 } |
465 | |
466 } // namespace media | |
OLD | NEW |