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 #ifndef WEBRTC_VOICE_ENGINE_TEST_WIN_TEST_WINTESTDLG_H_ 11 #define WEBRTC_VOICE_ENGINE_TEST_WIN_TEST_WINTESTDLG_H_ 12 13 #if (_MSC_VER >= 1400) 14 #define PRINT_GET_RESULT(...) \ 15 { \ 16 _strMsg.Format(__VA_ARGS__); \ 17 SetDlgItemText(IDC_EDIT_GET_OUTPUT, _strMsg); \ 18 } \ 19 20 #define TEST(x, ...) \ 21 if (!(x)) \ 22 { \ 23 _strMsg.Format(__VA_ARGS__); \ 24 SetDlgItemText(IDC_EDIT_MESSAGE, _strMsg); \ 25 _strErr.Format(_T("FAILED (error=%d)"), _veBasePtr->LastError()); \ 26 SetDlgItemText(IDC_EDIT_RESULT, _strErr); \ 27 _failCount++; \ 28 SetDlgItemInt(IDC_EDIT_N_FAILS, _failCount); \ 29 SetDlgItemInt(IDC_EDIT_LAST_ERROR, _veBasePtr->LastError()); \ 30 } \ 31 else \ 32 { \ 33 _strMsg.Format(__VA_ARGS__); \ 34 SetDlgItemText(IDC_EDIT_MESSAGE, _strMsg); \ 35 SetDlgItemText(IDC_EDIT_RESULT, _T("OK")); \ 36 } \ 37 38 #define TEST2(x, ...) \ 39 if (!(x)) \ 40 { \ 41 _strMsg.Format(__VA_ARGS__); \ 42 ((CWinTestDlg*)_parentDialogPtr)->UpdateTest(true, _strMsg); \ 43 } \ 44 else \ 45 { \ 46 _strMsg.Format(__VA_ARGS__); \ 47 ((CWinTestDlg*)_parentDialogPtr)->UpdateTest(false, _strMsg); \ 48 } 49 #else 50 #define TEST(x, exp) \ 51 if (!(x)) \ 52 { \ 53 _strMsg.Format(exp); \ 54 SetDlgItemText(IDC_EDIT_MESSAGE, _strMsg); \ 55 _strErr.Format("FAILED (error=%d)", _veBasePtr->LastError()); \ 56 SetDlgItemText(IDC_EDIT_RESULT, _strErr); \ 57 _failCount++; \ 58 SetDlgItemInt(IDC_EDIT_N_FAILS, _failCount); \ 59 SetDlgItemInt(IDC_EDIT_LAST_ERROR, _veBasePtr->LastError()); \ 60 } \ 61 else \ 62 { \ 63 _strMsg.Format(exp); \ 64 SetDlgItemText(IDC_EDIT_MESSAGE, _strMsg); \ 65 SetDlgItemText(IDC_EDIT_RESULT, _T("OK")); \ 66 } \ 67 68 #define TEST2(x, exp) \ 69 if (!(x)) \ 70 { \ 71 _strMsg.Format(exp); \ 72 ((CWinTestDlg*)_parentDialogPtr)->UpdateTest(true, _strMsg); \ 73 } \ 74 else \ 75 { \ 76 _strMsg.Format(exp); \ 77 ((CWinTestDlg*)_parentDialogPtr)->UpdateTest(false, _strMsg); \ 78 } 79 #endif 80 81 #include <string> 82 83 #include "webrtc/voice_engine/include/voe_base.h" 84 #include "webrtc/voice_engine/include/voe_codec.h" 85 #include "webrtc/voice_engine/include/voe_dtmf.h" 86 #include "webrtc/voice_engine/include/voe_external_media.h" 87 #include "webrtc/voice_engine/include/voe_file.h" 88 #include "webrtc/voice_engine/include/voe_hardware.h" 89 #include "webrtc/voice_engine/include/voe_network.h" 90 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 91 #include "webrtc/voice_engine/include/voe_video_sync.h" 92 #include "webrtc/voice_engine/include/voe_volume_control.h" 93 94 #include "webrtc/voice_engine/include/voe_audio_processing.h" 95 #include "webrtc/voice_engine/include/voe_errors.h" 96 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 97 98 class MediaProcessImpl; 99 class ConnectionObserver; 100 class RxCallback; 101 class MyTransport; 102 103 using namespace webrtc; 104 105 #define MAX_NUM_OF_CHANNELS 10 106 107 // CWinTestDlg dialog 108 class CWinTestDlg : public CDialog, 109 public VoiceEngineObserver, 110 public VoERTPObserver 111 { 112 // Construction 113 public: 114 CWinTestDlg(CWnd* pParent = NULL); // standard constructor 115 virtual ~CWinTestDlg(); 116 117 // Dialog Data 118 enum { IDD = IDD_WINTEST_DIALOG }; 119 120 BOOL UpdateTest(bool failed, const CString& strMsg); 121 122 protected: 123 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 124 125 protected: // VoiceEngineObserver 126 virtual void CallbackOnError(int channel, int errCode); 127 128 protected: // VoERTPObserver 129 virtual void OnIncomingCSRCChanged( 130 int channel, unsigned int CSRC, bool added); 131 virtual void OnIncomingSSRCChanged( 132 int channel, unsigned int SSRC); 133 134 // Implementation 135 protected: 136 HICON m_hIcon; 137 138 // Generated message map functions 139 virtual BOOL OnInitDialog(); 140 afx_msg void OnSysCommand(UINT nID, LPARAM lParam); 141 afx_msg void OnPaint(); 142 afx_msg HCURSOR OnQueryDragIcon(); 143 DECLARE_MESSAGE_MAP() 144 public: 145 afx_msg void OnBnClickedButtonCreate1(); 146 afx_msg void OnBnClickedButtonDelete1(); 147 148 private: 149 VoiceEngine* _vePtr; 150 151 VoECodec* _veCodecPtr; 152 VoEExternalMedia* _veExternalMediaPtr; 153 VoEVolumeControl* _veVolumeControlPtr; 154 VoEHardware* _veHardwarePtr; 155 VoEVideoSync* _veVideoSyncPtr; 156 VoENetwork* _veNetworkPtr; 157 VoEFile* _veFilePtr; 158 VoEAudioProcessing* _veApmPtr; 159 VoEBase* _veBasePtr; 160 VoERTP_RTCP* _veRtpRtcpPtr; 161 162 MyTransport* _transportPtr; 163 MediaProcessImpl* _externalMediaPtr; 164 ConnectionObserver* _connectionObserverPtr; 165 RxCallback* _rxVadObserverPtr; 166 167 private: 168 int _failCount; 169 CString _strMsg; 170 CString _strErr; 171 bool _externalTransport; 172 bool _externalTransportBuild; 173 int _checkPlayFileIn; 174 int _checkPlayFileIn1; 175 int _checkPlayFileIn2; 176 int _checkPlayFileOut1; 177 int _checkPlayFileOut2; 178 int _checkAGC; 179 int _checkAGC1; 180 int _checkNS; 181 int _checkNS1; 182 int _checkEC; 183 int _checkVAD1; 184 int _checkVAD2; 185 int _checkSrtpTx1; 186 int _checkSrtpTx2; 187 int _checkSrtpRx1; 188 int _checkSrtpRx2; 189 int _checkConference1; 190 int _checkConference2; 191 int _checkOnHold1; 192 int _checkOnHold2; 193 bool _delayEstimate1; 194 bool _delayEstimate2; 195 bool _rxVad; 196 int _nErrorCallbacks; 197 int _timerTicks; 198 std::string _long_audio_file_path; 199 200 public: 201 afx_msg void OnBnClickedButtonCreate2(); 202 afx_msg void OnBnClickedButtonDelete2(); 203 afx_msg void OnCbnSelchangeComboCodec1(); 204 afx_msg void OnBnClickedButtonStartListen1(); 205 afx_msg void OnBnClickedButtonStopListen1(); 206 afx_msg void OnBnClickedButtonStartPlayout1(); 207 afx_msg void OnBnClickedButtonStopPlayout1(); 208 afx_msg void OnBnClickedButtonStartSend1(); 209 afx_msg void OnBnClickedButtonStopSend1(); 210 afx_msg void OnCbnSelchangeComboIp2(); 211 afx_msg void OnCbnSelchangeComboIp1(); 212 afx_msg void OnCbnSelchangeComboCodec2(); 213 afx_msg void OnBnClickedButtonStartListen2(); 214 afx_msg void OnBnClickedButtonStopListen2(); 215 afx_msg void OnBnClickedButtonStartPlayout2(); 216 afx_msg void OnBnClickedButtonStopPlayout2(); 217 afx_msg void OnBnClickedButtonStartSend2(); 218 afx_msg void OnBnClickedButtonStopSend2(); 219 afx_msg void OnBnClickedButtonTest11(); 220 afx_msg void OnBnClickedCheckExtTrans1(); 221 afx_msg void OnBnClickedCheckPlayFileIn1(); 222 afx_msg void OnBnClickedCheckPlayFileOut1(); 223 afx_msg void OnBnClickedCheckExtTrans2(); 224 afx_msg void OnBnClickedCheckPlayFileIn2(); 225 afx_msg void OnBnClickedCheckPlayFileOut2(); 226 afx_msg void OnBnClickedCheckPlayFileIn(); 227 afx_msg void OnBnClickedCheckPlayFileOut(); 228 afx_msg void OnCbnSelchangeComboRecDevice(); 229 afx_msg void OnCbnSelchangeComboPlayDevice(); 230 afx_msg void OnBnClickedCheckExtMediaIn1(); 231 afx_msg void OnBnClickedCheckExtMediaOut1(); 232 afx_msg void OnNMReleasedcaptureSliderInputVolume(NMHDR *pNMHDR, LRESULT *pResult); 233 afx_msg void OnNMReleasedcaptureSliderOutputVolume(NMHDR *pNMHDR, LRESULT *pResult); 234 afx_msg void OnTimer(UINT_PTR nIDEvent); 235 afx_msg void OnBnClickedCheckAgc(); 236 CString _strComboIp1; 237 CString _strComboIp2; 238 afx_msg void OnBnClickedCheckNs(); 239 afx_msg void OnBnClickedCheckEc(); 240 afx_msg void OnBnClickedCheckVad1(); 241 afx_msg void OnBnClickedCheckVad2(); 242 afx_msg void OnBnClickedCheckExtMediaIn2(); 243 afx_msg void OnBnClickedCheckExtMediaOut2(); 244 afx_msg void OnBnClickedCheckMuteIn(); 245 afx_msg void OnBnClickedCheckMuteIn1(); 246 afx_msg void OnBnClickedCheckMuteIn2(); 247 afx_msg void OnBnClickedCheckSrtpTx1(); 248 afx_msg void OnBnClickedCheckSrtpRx1(); 249 afx_msg void OnBnClickedCheckSrtpTx2(); 250 afx_msg void OnBnClickedCheckSrtpRx2(); 251 afx_msg void OnBnClickedButtonDtmf1(); 252 afx_msg void OnBnClickedCheckRecMic(); 253 afx_msg void OnBnClickedButtonDtmf2(); 254 afx_msg void OnBnClickedButtonTest1(); 255 afx_msg void OnBnClickedCheckConference1(); 256 afx_msg void OnBnClickedCheckConference2(); 257 afx_msg void OnBnClickedCheckOnHold1(); 258 afx_msg void OnBnClickedCheckOnHold2(); 259 afx_msg void OnBnClickedCheckExtMediaIn(); 260 afx_msg void OnBnClickedCheckExtMediaOut(); 261 afx_msg void OnLbnSelchangeListCodec1(); 262 afx_msg void OnNMReleasedcaptureSliderPanLeft(NMHDR *pNMHDR, LRESULT *pResult); 263 afx_msg void OnNMReleasedcaptureSliderPanRight(NMHDR *pNMHDR, LRESULT *pResult); 264 afx_msg void OnBnClickedButtonVersion(); 265 afx_msg void OnBnClickedCheckDelayEstimate1(); 266 afx_msg void OnBnClickedCheckRxvad(); 267 afx_msg void OnBnClickedCheckAgc1(); 268 afx_msg void OnBnClickedCheckNs1(); 269 afx_msg void OnBnClickedCheckRecCall(); 270 afx_msg void OnBnClickedCheckTypingDetection(); 271 afx_msg void OnBnClickedCheckRED(); 272 afx_msg void OnBnClickedButtonClearErrorCallback(); 273 afx_msg void OnBnClickedCheckBwe1(); 274 }; 275 276 #endif // WEBRTC_VOICE_ENGINE_TEST_WIN_TEST_WINTESTDLG_H_ 277