| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 using namespace webrtc; | 45 using namespace webrtc; |
| 46 using namespace test; | 46 using namespace test; |
| 47 | 47 |
| 48 #define VALIDATE \ | 48 #define VALIDATE \ |
| 49 if (res != 0) { \ | 49 if (res != 0) { \ |
| 50 printf("*** Error at line %i \n", __LINE__); \ | 50 printf("*** Error at line %i \n", __LINE__); \ |
| 51 printf("*** Error code = %i \n", base1->LastError()); \ | 51 printf("*** Error code = %i \n", base1->LastError()); \ |
| 52 } | 52 } |
| 53 | 53 |
| 54 VoiceEngine* m_voe = NULL; | 54 VoiceEngine* m_voe = nullptr; |
| 55 VoEBase* base1 = NULL; | 55 VoEBase* base1 = nullptr; |
| 56 VoECodec* codec = NULL; | 56 VoECodec* codec = nullptr; |
| 57 VoEVolumeControl* volume = NULL; | 57 VoEVolumeControl* volume = nullptr; |
| 58 VoERTP_RTCP* rtp_rtcp = NULL; | 58 VoERTP_RTCP* rtp_rtcp = nullptr; |
| 59 VoEAudioProcessing* apm = NULL; | 59 VoEAudioProcessing* apm = nullptr; |
| 60 VoENetwork* netw = NULL; | 60 VoENetwork* netw = nullptr; |
| 61 VoEFile* file = NULL; | 61 VoEFile* file = nullptr; |
| 62 VoEVideoSync* vsync = NULL; | 62 VoEVideoSync* vsync = nullptr; |
| 63 VoEHardware* hardware = NULL; | 63 VoEHardware* hardware = nullptr; |
| 64 VoEExternalMedia* xmedia = NULL; | 64 VoEExternalMedia* xmedia = nullptr; |
| 65 VoENetEqStats* neteqst = NULL; | 65 VoENetEqStats* neteqst = nullptr; |
| 66 | 66 |
| 67 void RunTest(std::string out_path); | 67 void RunTest(std::string out_path); |
| 68 | 68 |
| 69 class MyObserver : public VoiceEngineObserver { | 69 class MyObserver : public VoiceEngineObserver { |
| 70 public: | 70 public: |
| 71 virtual void CallbackOnError(int channel, int err_code); | 71 virtual void CallbackOnError(int channel, int err_code); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 void MyObserver::CallbackOnError(int channel, int err_code) { | 74 void MyObserver::CallbackOnError(int channel, int err_code) { |
| 75 // Add printf for other error codes here | 75 // Add printf for other error codes here |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 MyObserver my_observer; | 139 MyObserver my_observer; |
| 140 | 140 |
| 141 std::unique_ptr<test::TraceToStderr> trace_to_stderr; | 141 std::unique_ptr<test::TraceToStderr> trace_to_stderr; |
| 142 if (!FLAGS_use_log_file) { | 142 if (!FLAGS_use_log_file) { |
| 143 trace_to_stderr.reset(new test::TraceToStderr); | 143 trace_to_stderr.reset(new test::TraceToStderr); |
| 144 } else { | 144 } else { |
| 145 const std::string trace_filename = test::OutputPath() + "webrtc_trace.txt"; | 145 const std::string trace_filename = test::OutputPath() + "webrtc_trace.txt"; |
| 146 VoiceEngine::SetTraceFilter(kTraceAll); | 146 VoiceEngine::SetTraceFilter(kTraceAll); |
| 147 res = VoiceEngine::SetTraceFile(trace_filename.c_str()); | 147 res = VoiceEngine::SetTraceFile(trace_filename.c_str()); |
| 148 VALIDATE; | 148 VALIDATE; |
| 149 res = VoiceEngine::SetTraceCallback(NULL); | 149 res = VoiceEngine::SetTraceCallback(nullptr); |
| 150 VALIDATE; | 150 VALIDATE; |
| 151 printf("Outputting logs to file: %s\n", trace_filename.c_str()); | 151 printf("Outputting logs to file: %s\n", trace_filename.c_str()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 printf("Init\n"); | 154 printf("Init\n"); |
| 155 res = base1->Init(); | 155 res = base1->Init(); |
| 156 if (res != 0) { | 156 if (res != 0) { |
| 157 printf("\nError calling Init: %d\n", base1->LastError()); | 157 printf("\nError calling Init: %d\n", base1->LastError()); |
| 158 fflush(NULL); | 158 fflush(nullptr); |
| 159 exit(1); | 159 exit(1); |
| 160 } | 160 } |
| 161 | 161 |
| 162 res = base1->RegisterVoiceEngineObserver(my_observer); | 162 res = base1->RegisterVoiceEngineObserver(my_observer); |
| 163 VALIDATE; | 163 VALIDATE; |
| 164 | 164 |
| 165 printf("Version\n"); | 165 printf("Version\n"); |
| 166 char tmp[1024]; | 166 char tmp[1024]; |
| 167 res = base1->GetVersion(tmp); | 167 res = base1->GetVersion(tmp); |
| 168 VALIDATE; | 168 VALIDATE; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 const std::string audio_filename = | 232 const std::string audio_filename = |
| 233 webrtc::test::ResourcePath("voice_engine/audio_long16", "pcm"); | 233 webrtc::test::ResourcePath("voice_engine/audio_long16", "pcm"); |
| 234 | 234 |
| 235 const std::string play_filename = out_path + "recorded_playout.pcm"; | 235 const std::string play_filename = out_path + "recorded_playout.pcm"; |
| 236 const std::string mic_filename = out_path + "recorded_mic.pcm"; | 236 const std::string mic_filename = out_path + "recorded_mic.pcm"; |
| 237 | 237 |
| 238 chan = base1->CreateChannel(); | 238 chan = base1->CreateChannel(); |
| 239 if (chan < 0) { | 239 if (chan < 0) { |
| 240 printf("************ Error code = %i\n", base1->LastError()); | 240 printf("************ Error code = %i\n", base1->LastError()); |
| 241 fflush(NULL); | 241 fflush(nullptr); |
| 242 } | 242 } |
| 243 | 243 |
| 244 VoiceChannelTransport* voice_channel_transport( | 244 VoiceChannelTransport* voice_channel_transport( |
| 245 new VoiceChannelTransport(netw, chan)); | 245 new VoiceChannelTransport(netw, chan)); |
| 246 | 246 |
| 247 char ip[64]; | 247 char ip[64]; |
| 248 printf("1. 127.0.0.1 \n"); | 248 printf("1. 127.0.0.1 \n"); |
| 249 printf("2. Specify IP \n"); | 249 printf("2. Specify IP \n"); |
| 250 int ip_selection; | 250 int ip_selection; |
| 251 ASSERT_EQ(1, scanf("%i", &ip_selection)); | 251 ASSERT_EQ(1, scanf("%i", &ip_selection)); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 int end_option; | 783 int end_option; |
| 784 ASSERT_EQ(1, scanf("%i", &end_option)); | 784 ASSERT_EQ(1, scanf("%i", &end_option)); |
| 785 newcall = (end_option == 1); | 785 newcall = (end_option == 1); |
| 786 // Call loop | 786 // Call loop |
| 787 } | 787 } |
| 788 | 788 |
| 789 // Transports should be deleted before channel deletion. | 789 // Transports should be deleted before channel deletion. |
| 790 delete voice_channel_transport; | 790 delete voice_channel_transport; |
| 791 for (int i = 0; i < kMaxNumChannels; ++i) { | 791 for (int i = 0; i < kMaxNumChannels; ++i) { |
| 792 delete voice_channel_transports[i]; | 792 delete voice_channel_transports[i]; |
| 793 voice_channel_transports[i] = NULL; | 793 voice_channel_transports[i] = nullptr; |
| 794 } | 794 } |
| 795 | 795 |
| 796 printf("Delete channels \n"); | 796 printf("Delete channels \n"); |
| 797 res = base1->DeleteChannel(chan); | 797 res = base1->DeleteChannel(chan); |
| 798 VALIDATE; | 798 VALIDATE; |
| 799 | 799 |
| 800 for (int i = 0; i < kMaxNumChannels; ++i) { | 800 for (int i = 0; i < kMaxNumChannels; ++i) { |
| 801 res = base1->DeleteChannel(channels[i]); | 801 res = base1->DeleteChannel(channels[i]); |
| 802 VALIDATE; | 802 VALIDATE; |
| 803 } | 803 } |
| 804 } | 804 } |
| OLD | NEW |