Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / voice_engine / test / auto_test / voe_standard_test.h
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_VOICE_ENGINE_VOE_STANDARD_TEST_H
12 #define WEBRTC_VOICE_ENGINE_VOE_STANDARD_TEST_H
13
14 #include <stdio.h>
15 #include <string>
16
17 #include "gflags/gflags.h"
18 #include "webrtc/common.h"
19 #include "webrtc/voice_engine/include/voe_audio_processing.h"
20 #include "webrtc/voice_engine/include/voe_base.h"
21 #include "webrtc/voice_engine/include/voe_dtmf.h"
22 #include "webrtc/voice_engine/include/voe_errors.h"
23 #include "webrtc/voice_engine/include/voe_file.h"
24 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
25 #include "webrtc/voice_engine/test/auto_test/resource_manager.h"
26 #include "webrtc/voice_engine/test/auto_test/voe_test_common.h"
27 #include "webrtc/voice_engine/test/auto_test/voe_test_interface.h"
28 #ifdef WEBRTC_VOICE_ENGINE_CALL_REPORT_API
29 #include "webrtc/voice_engine/include/voe_call_report.h"
30 #endif
31 #ifdef WEBRTC_VOICE_ENGINE_CODEC_API
32 #include "webrtc/voice_engine/include/voe_codec.h"
33 #endif
34 #ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
35 #include "webrtc/voice_engine/include/voe_encryption.h"
36 #endif
37 #ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
38 #include "webrtc/voice_engine/include/voe_external_media.h"
39 #endif
40 #ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
41 #include "webrtc/voice_engine/include/voe_hardware.h"
42 #endif
43 #include "webrtc/voice_engine/include/voe_network.h"
44 #ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
45 #include "webrtc/voice_engine/include/voe_video_sync.h"
46 #endif
47 #ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
48 #include "webrtc/voice_engine/include/voe_volume_control.h"
49 #endif
50
51 #ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
52 namespace webrtc {
53 class CriticalSectionWrapper;
54 class ThreadWrapper;
55 class VoENetEqStats;
56 }
57 #endif
58
59 #if defined(WEBRTC_ANDROID)
60 extern char mobileLogMsg[640];
61 #endif
62
63 DECLARE_bool(include_timing_dependent_tests);
64
65 namespace voetest {
66
67 class SubAPIManager {
68  public:
69   SubAPIManager()
70     : _base(true),
71       _callReport(false),
72       _codec(false),
73       _dtmf(false),
74       _encryption(false),
75       _externalMedia(false),
76       _file(false),
77       _hardware(false),
78       _netEqStats(false),
79       _network(false),
80       _rtp_rtcp(false),
81       _videoSync(false),
82       _volumeControl(false),
83       _apm(false) {
84 #ifdef WEBRTC_VOICE_ENGINE_CALL_REPORT_API
85       _callReport = true;
86 #endif
87 #ifdef WEBRTC_VOICE_ENGINE_CODEC_API
88       _codec = true;
89 #endif
90 #ifdef WEBRTC_VOICE_ENGINE_DTMF_API
91       _dtmf = true;
92 #endif
93 #ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
94       _encryption = true;
95 #endif
96 #ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
97       _externalMedia = true;
98 #endif
99 #ifdef WEBRTC_VOICE_ENGINE_FILE_API
100       _file = true;
101 #endif
102 #ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
103       _hardware = true;
104 #endif
105 #ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
106       _netEqStats = true;
107 #endif
108       _network = true;
109 #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
110       _rtp_rtcp = true;
111 #endif
112 #ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
113       _videoSync = true;
114 #endif
115 #ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
116       _volumeControl = true;
117 #endif
118 #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
119       _apm = true;
120 #endif
121   }
122
123   void DisplayStatus() const;
124
125  private:
126   bool _base, _callReport, _codec, _dtmf, _encryption;
127   bool _externalMedia, _file, _hardware;
128   bool _netEqStats, _network, _rtp_rtcp, _videoSync, _volumeControl, _apm;
129 };
130
131 class VoETestManager {
132  public:
133   VoETestManager();
134   ~VoETestManager();
135
136   // Must be called after construction.
137   bool Init();
138
139   void GetInterfaces();
140   int ReleaseInterfaces();
141
142   const char* AudioFilename() const {
143     const std::string& result = resource_manager_.long_audio_file_path();
144     if (result.length() == 0) {
145       TEST_LOG("ERROR: Failed to open input file!");
146     }
147     return result.c_str();
148   }
149
150   VoiceEngine* VoiceEnginePtr() const {
151     return voice_engine_;
152   }
153   VoEBase* BasePtr() const {
154     return voe_base_;
155   }
156   VoECodec* CodecPtr() const {
157     return voe_codec_;
158   }
159   VoEVolumeControl* VolumeControlPtr() const {
160     return voe_volume_control_;
161   }
162   VoEDtmf* DtmfPtr() const {
163     return voe_dtmf_;
164   }
165   VoERTP_RTCP* RTP_RTCPPtr() const {
166     return voe_rtp_rtcp_;
167   }
168   VoEAudioProcessing* APMPtr() const {
169     return voe_apm_;
170   }
171
172   VoENetwork* NetworkPtr() const {
173     return voe_network_;
174   }
175
176   VoEFile* FilePtr() const {
177     return voe_file_;
178   }
179
180   VoEHardware* HardwarePtr() const {
181     return voe_hardware_;
182   }
183
184   VoEVideoSync* VideoSyncPtr() const {
185     return voe_vsync_;
186   }
187
188   VoEEncryption* EncryptionPtr() const {
189     return voe_encrypt_;
190   }
191
192   VoEExternalMedia* ExternalMediaPtr() const {
193     return voe_xmedia_;
194   }
195
196   VoECallReport* CallReportPtr() const {
197     return voe_call_report_;
198   }
199
200 #ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
201   VoENetEqStats* NetEqStatsPtr() const {
202     return voe_neteq_stats_;
203   }
204 #endif
205
206  private:
207   bool                   initialized_;
208
209   VoiceEngine*           voice_engine_;
210   VoEBase*               voe_base_;
211   VoECallReport*         voe_call_report_;
212   VoECodec*              voe_codec_;
213   VoEDtmf*               voe_dtmf_;
214   VoEEncryption*         voe_encrypt_;
215   VoEExternalMedia*      voe_xmedia_;
216   VoEFile*               voe_file_;
217   VoEHardware*           voe_hardware_;
218   VoENetwork*            voe_network_;
219 #ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
220   VoENetEqStats*         voe_neteq_stats_;
221 #endif
222   VoERTP_RTCP*           voe_rtp_rtcp_;
223   VoEVideoSync*          voe_vsync_;
224   VoEVolumeControl*      voe_volume_control_;
225   VoEAudioProcessing*    voe_apm_;
226
227   ResourceManager        resource_manager_;
228
229   Config                 config_;
230 };
231
232 }  // namespace voetest
233
234 #endif // WEBRTC_VOICE_ENGINE_VOE_STANDARD_TEST_H