Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1423)

Side by Side Diff: media/audio/audio_low_latency_input_output_unittest.cc

Issue 9805001: Move media/audio files into media namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_io.h ('k') | media/audio/audio_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
32 #if defined(OS_LINUX) || defined(OS_OPENBSD) 36 #if defined(OS_LINUX) || defined(OS_OPENBSD)
33 typedef AudioManagerLinux AudioManagerAnyPlatform; 37 typedef AudioManagerLinux AudioManagerAnyPlatform;
34 #elif defined(OS_MACOSX) 38 #elif defined(OS_MACOSX)
35 typedef AudioManagerMac AudioManagerAnyPlatform; 39 typedef AudioManagerMac AudioManagerAnyPlatform;
36 #elif defined(OS_WIN) 40 #elif defined(OS_WIN)
37 typedef AudioManagerWin AudioManagerAnyPlatform; 41 typedef AudioManagerWin AudioManagerAnyPlatform;
38 #elif defined(OS_ANDROID) 42 #elif defined(OS_ANDROID)
39 typedef AudioManagerAndroid AudioManagerAnyPlatform; 43 typedef AudioManagerAndroid AudioManagerAnyPlatform;
40 #endif 44 #endif
41 45
42 using base::win::ScopedCOMInitializer;
43
44 namespace {
45 // Limits the number of delay measurements we can store in an array and 46 // Limits the number of delay measurements we can store in an array and
46 // then write to file at end of the WASAPIAudioInputOutputFullDuplex test. 47 // then write to file at end of the WASAPIAudioInputOutputFullDuplex test.
47 static const size_t kMaxDelayMeasurements = 1000; 48 static const size_t kMaxDelayMeasurements = 1000;
48 49
49 // Name of the output text file. The output file will be stored in the 50 // Name of the output text file. The output file will be stored in the
50 // directory containing media_unittests.exe. 51 // directory containing media_unittests.exe.
51 // Example: \src\build\Debug\audio_delay_values_ms.txt. 52 // Example: \src\build\Debug\audio_delay_values_ms.txt.
52 // See comments for the WASAPIAudioInputOutputFullDuplex test for more details 53 // See comments for the WASAPIAudioInputOutputFullDuplex test for more details
53 // about the file format. 54 // about the file format.
54 static const char* kDelayValuesFileName = "audio_delay_values_ms.txt"; 55 static const char* kDelayValuesFileName = "audio_delay_values_ms.txt";
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return input && output; 116 return input && output;
116 } 117 }
117 118
118 private: 119 private:
119 MessageLoopForUI message_loop_; 120 MessageLoopForUI message_loop_;
120 MockAudioManager mock_audio_manager_; 121 MockAudioManager mock_audio_manager_;
121 122
122 DISALLOW_COPY_AND_ASSIGN(AudioLowLatencyInputOutputTest); 123 DISALLOW_COPY_AND_ASSIGN(AudioLowLatencyInputOutputTest);
123 }; 124 };
124 125
125 } // namespace
126
127 // This audio source/sink implementation should be used for manual tests 126 // This audio source/sink implementation should be used for manual tests
128 // only since delay measurements are stored on an output text file. 127 // only since delay measurements are stored on an output text file.
129 // All incoming/recorded audio packets are stored in an intermediate media 128 // All incoming/recorded audio packets are stored in an intermediate media
130 // buffer which the renderer reads from when it needs audio for playout. 129 // buffer which the renderer reads from when it needs audio for playout.
131 // The total effect is that recorded audio is played out in loop back using 130 // The total effect is that recorded audio is played out in loop back using
132 // a sync buffer as temporary storage. 131 // a sync buffer as temporary storage.
133 class FullDuplexAudioSinkSource 132 class FullDuplexAudioSinkSource
134 133
135 : public AudioInputStream::AudioInputCallback, 134 : public AudioInputStream::AudioInputCallback,
136 public AudioOutputStream::AudioSourceCallback { 135 public AudioOutputStream::AudioSourceCallback {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 aos->Stop(); 449 aos->Stop();
451 ais->Stop(); 450 ais->Stop();
452 451
453 // All Close() operations that run on the mocked audio thread, 452 // All Close() operations that run on the mocked audio thread,
454 // should be synchronous and not post additional close tasks to 453 // should be synchronous and not post additional close tasks to
455 // mocked the audio thread. Hence, there is no need to call 454 // mocked the audio thread. Hence, there is no need to call
456 // message_loop()->RunAllPending() after the Close() methods. 455 // message_loop()->RunAllPending() after the Close() methods.
457 aos->Close(); 456 aos->Close();
458 ais->Close(); 457 ais->Close();
459 } 458 }
459
460 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_io.h ('k') | media/audio/audio_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698