| OLD | NEW |
| (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 #include "webrtc/voice_engine/test/auto_test/voe_cpu_test.h" | |
| 12 | |
| 13 #include <stdio.h> | |
| 14 #include <string.h> | |
| 15 #include <time.h> | |
| 16 #if defined(_WIN32) | |
| 17 #include <conio.h> | |
| 18 #endif | |
| 19 | |
| 20 #include <memory> | |
| 21 | |
| 22 #include "webrtc/voice_engine/test/channel_transport/channel_transport.h" | |
| 23 #include "webrtc/voice_engine/test/auto_test/voe_test_defines.h" | |
| 24 | |
| 25 using namespace webrtc; | |
| 26 using namespace test; | |
| 27 | |
| 28 namespace voetest { | |
| 29 | |
| 30 #define CHECK(expr) \ | |
| 31 if (expr) \ | |
| 32 { \ | |
| 33 printf("Error at line: %i, %s \n", __LINE__, #expr); \ | |
| 34 printf("Error code: %i \n", base->LastError()); \ | |
| 35 PAUSE
\ | |
| 36 return -1; \ | |
| 37 } | |
| 38 | |
| 39 VoECpuTest::VoECpuTest(VoETestManager& mgr) | |
| 40 : _mgr(mgr) { | |
| 41 | |
| 42 } | |
| 43 | |
| 44 int VoECpuTest::DoTest() { | |
| 45 printf("------------------------------------------------\n"); | |
| 46 printf(" CPU Reference Test\n"); | |
| 47 printf("------------------------------------------------\n"); | |
| 48 | |
| 49 VoEBase* base = _mgr.BasePtr(); | |
| 50 VoEFile* file = _mgr.FilePtr(); | |
| 51 VoECodec* codec = _mgr.CodecPtr(); | |
| 52 VoEAudioProcessing* apm = _mgr.APMPtr(); | |
| 53 VoENetwork* voe_network = _mgr.NetworkPtr(); | |
| 54 | |
| 55 int channel(-1); | |
| 56 CodecInst isac; | |
| 57 | |
| 58 isac.pltype = 104; | |
| 59 strcpy(isac.plname, "ISAC"); | |
| 60 isac.pacsize = 960; | |
| 61 isac.plfreq = 32000; | |
| 62 isac.channels = 1; | |
| 63 isac.rate = -1; | |
| 64 | |
| 65 CHECK(base->Init()); | |
| 66 channel = base->CreateChannel(); | |
| 67 | |
| 68 std::unique_ptr<VoiceChannelTransport> voice_socket_transport( | |
| 69 new VoiceChannelTransport(voe_network, channel)); | |
| 70 | |
| 71 CHECK(voice_socket_transport->SetSendDestination("127.0.0.1", 5566)); | |
| 72 CHECK(voice_socket_transport->SetLocalReceiver(5566)); | |
| 73 | |
| 74 CHECK(codec->SetRecPayloadType(channel, isac)); | |
| 75 CHECK(codec->SetSendCodec(channel, isac)); | |
| 76 | |
| 77 CHECK(base->StartPlayout(channel)); | |
| 78 CHECK(base->StartSend(channel)); | |
| 79 CHECK(file->StartPlayingFileAsMicrophone(channel, _mgr.AudioFilename(), | |
| 80 true, true)); | |
| 81 | |
| 82 CHECK(codec->SetVADStatus(channel, true)); | |
| 83 CHECK(apm->SetAgcStatus(true, kAgcAdaptiveAnalog)); | |
| 84 CHECK(apm->SetNsStatus(true, kNsModerateSuppression)); | |
| 85 CHECK(apm->SetEcStatus(true, kEcAec)); | |
| 86 | |
| 87 TEST_LOG("\nMeasure CPU and memory while running a full-duplex" | |
| 88 " iSAC-swb call.\n\n"); | |
| 89 | |
| 90 PAUSE | |
| 91 | |
| 92 CHECK(base->StopSend(channel)); | |
| 93 CHECK(base->StopPlayout(channel)); | |
| 94 | |
| 95 base->DeleteChannel(channel); | |
| 96 CHECK(base->Terminate()); | |
| 97 return 0; | |
| 98 } | |
| 99 | |
| 100 } // namespace voetest | |
| OLD | NEW |