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