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

Side by Side Diff: webrtc/modules/audio_device/test/func_test_manager.h

Issue 2255173002: Remove audio_device_test_func. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_AUDIO_DEVICE_FUNC_TEST_MANAGER_H
12 #define WEBRTC_AUDIO_DEVICE_FUNC_TEST_MANAGER_H
13
14 #include <list>
15 #include <memory>
16 #include <string>
17
18 #include "webrtc/common_audio/resampler/include/resampler.h"
19 #include "webrtc/modules/audio_device/include/audio_device.h"
20 #include "webrtc/modules/audio_device/test/audio_device_test_defines.h"
21 #include "webrtc/system_wrappers/include/file_wrapper.h"
22 #include "webrtc/typedefs.h"
23
24
25 #define ADM_AUDIO_LAYER AudioDeviceModule::kPlatformDefaultAudio
26 //#define ADM_AUDIO_LAYER AudioDeviceModule::kLinuxPulseAudio
27
28 enum TestType
29 {
30 TTInvalid = -1,
31 TTAll = 0,
32 TTAudioLayerSelection = 1,
33 TTDeviceEnumeration = 2,
34 TTDeviceSelection = 3,
35 TTAudioTransport = 4,
36 TTSpeakerVolume = 5,
37 TTMicrophoneVolume = 6,
38 TTSpeakerMute = 7,
39 TTMicrophoneMute = 8,
40 TTMicrophoneBoost = 9,
41 TTMicrophoneAGC = 10,
42 TTLoopback = 11,
43 TTDeviceRemoval = 13,
44 TTMobileAPI = 14,
45 TTTest = 66,
46 };
47
48 struct AudioPacket
49 {
50 uint8_t dataBuffer[4 * 960];
51 size_t nSamples;
52 size_t nBytesPerSample;
53 size_t nChannels;
54 uint32_t samplesPerSec;
55 };
56
57 class ProcessThread;
58
59 namespace webrtc
60 {
61
62 class AudioDeviceModule;
63 class AudioEventObserver;
64 class AudioTransport;
65
66 // ----------------------------------------------------------------------------
67 // AudioEventObserver
68 // ----------------------------------------------------------------------------
69
70 class AudioEventObserver: public AudioDeviceObserver
71 {
72 public:
73 virtual void OnErrorIsReported(const ErrorCode error);
74 virtual void OnWarningIsReported(const WarningCode warning);
75 AudioEventObserver(AudioDeviceModule* audioDevice);
76 ~AudioEventObserver();
77 public:
78 ErrorCode _error;
79 WarningCode _warning;
80 };
81
82 // ----------------------------------------------------------------------------
83 // AudioTransport
84 // ----------------------------------------------------------------------------
85
86 class AudioTransportImpl: public AudioTransport
87 {
88 public:
89 int32_t RecordedDataIsAvailable(const void* audioSamples,
90 const size_t nSamples,
91 const size_t nBytesPerSample,
92 const size_t nChannels,
93 const uint32_t samplesPerSec,
94 const uint32_t totalDelayMS,
95 const int32_t clockDrift,
96 const uint32_t currentMicLevel,
97 const bool keyPressed,
98 uint32_t& newMicLevel) override;
99
100 int32_t NeedMorePlayData(const size_t nSamples,
101 const size_t nBytesPerSample,
102 const size_t nChannels,
103 const uint32_t samplesPerSec,
104 void* audioSamples,
105 size_t& nSamplesOut,
106 int64_t* elapsed_time_ms,
107 int64_t* ntp_time_ms) override;
108
109 void PushCaptureData(int voe_channel,
110 const void* audio_data,
111 int bits_per_sample,
112 int sample_rate,
113 size_t number_of_channels,
114 size_t number_of_frames) override;
115
116 void PullRenderData(int bits_per_sample,
117 int sample_rate,
118 size_t number_of_channels,
119 size_t number_of_frames,
120 void* audio_data,
121 int64_t* elapsed_time_ms,
122 int64_t* ntp_time_ms) override;
123
124 AudioTransportImpl(AudioDeviceModule* audioDevice);
125 ~AudioTransportImpl();
126
127 public:
128 int32_t SetFilePlayout(bool enable, const char* fileName = NULL);
129 void SetFullDuplex(bool enable);
130 void SetSpeakerVolume(bool enable)
131 {
132 _speakerVolume = enable;
133 }
134 ;
135 void SetSpeakerMute(bool enable)
136 {
137 _speakerMute = enable;
138 }
139 ;
140 void SetMicrophoneMute(bool enable)
141 {
142 _microphoneMute = enable;
143 }
144 ;
145 void SetMicrophoneVolume(bool enable)
146 {
147 _microphoneVolume = enable;
148 }
149 ;
150 void SetMicrophoneBoost(bool enable)
151 {
152 _microphoneBoost = enable;
153 }
154 ;
155 void SetLoopbackMeasurements(bool enable)
156 {
157 _loopBackMeasurements = enable;
158 }
159 ;
160 void SetMicrophoneAGC(bool enable)
161 {
162 _microphoneAGC = enable;
163 }
164 ;
165
166 private:
167 typedef std::list<AudioPacket*> AudioPacketList;
168 AudioDeviceModule* _audioDevice;
169
170 bool _playFromFile;
171 bool _fullDuplex;
172 bool _speakerVolume;
173 bool _speakerMute;
174 bool _microphoneVolume;
175 bool _microphoneMute;
176 bool _microphoneBoost;
177 bool _microphoneAGC;
178 bool _loopBackMeasurements;
179
180 FileWrapper& _playFile;
181
182 uint32_t _recCount;
183 uint32_t _playCount;
184 AudioPacketList _audioList;
185
186 Resampler _resampler;
187 };
188
189 // ----------------------------------------------------------------------------
190 // FuncTestManager
191 // ----------------------------------------------------------------------------
192
193 class FuncTestManager
194 {
195 public:
196 FuncTestManager();
197 ~FuncTestManager();
198 int32_t Init();
199 int32_t Close();
200 int32_t DoTest(const TestType testType);
201 private:
202 int32_t TestAudioLayerSelection();
203 int32_t TestDeviceEnumeration();
204 int32_t TestDeviceSelection();
205 int32_t TestAudioTransport();
206 int32_t TestSpeakerVolume();
207 int32_t TestMicrophoneVolume();
208 int32_t TestSpeakerMute();
209 int32_t TestMicrophoneMute();
210 int32_t TestMicrophoneBoost();
211 int32_t TestLoopback();
212 int32_t TestDeviceRemoval();
213 int32_t TestExtra();
214 int32_t TestMicrophoneAGC();
215 int32_t SelectPlayoutDevice();
216 int32_t SelectRecordingDevice();
217 int32_t TestAdvancedMBAPI();
218 private:
219 // Paths to where the resource files to be used for this test are located.
220 std::string _playoutFile48;
221 std::string _playoutFile44;
222 std::string _playoutFile16;
223 std::string _playoutFile8;
224
225 std::unique_ptr<ProcessThread> _processThread;
226 AudioDeviceModule* _audioDevice;
227 AudioEventObserver* _audioEventObserver;
228 AudioTransportImpl* _audioTransport;
229 };
230
231 } // namespace webrtc
232
233 #endif // #ifndef WEBRTC_AUDIO_DEVICE_FUNC_TEST_MANAGER_H
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/test/audio_device_test_func.cc ('k') | webrtc/modules/audio_device/test/func_test_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698