Fixed many formatting and indentation problems in voe_auto_test.
Fixed indentation. There is nothing but whitespace changes here, except for removing some extraneous semicolons in .h files and fixing a spelling error in a comment. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/305004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1122 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
598ad06432
commit
693240f2d9
@ -13,7 +13,7 @@
|
||||
#include <time.h>
|
||||
#include <cassert>
|
||||
#if defined(_WIN32)
|
||||
#include <conio.h>
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
#include "voe_cpu_test.h"
|
||||
@ -37,65 +37,63 @@ extern int GetResource(char* resource, char* dest, int destLen);
|
||||
extern char* GetResource(char* resource);
|
||||
extern const char* GetResource(const char* resource);
|
||||
|
||||
VoECpuTest::VoECpuTest(VoETestManager& mgr) :
|
||||
_mgr(mgr)
|
||||
{
|
||||
|
||||
VoECpuTest::VoECpuTest(VoETestManager& mgr)
|
||||
: _mgr(mgr) {
|
||||
|
||||
}
|
||||
|
||||
int VoECpuTest::DoTest()
|
||||
{
|
||||
printf("------------------------------------------------\n");
|
||||
printf(" CPU Reference Test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
int VoECpuTest::DoTest() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf(" CPU Reference Test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
VoEFile* file = _mgr.FilePtr();
|
||||
VoECodec* codec = _mgr.CodecPtr();
|
||||
VoEAudioProcessing* apm = _mgr.APMPtr();
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
VoEFile* file = _mgr.FilePtr();
|
||||
VoECodec* codec = _mgr.CodecPtr();
|
||||
VoEAudioProcessing* apm = _mgr.APMPtr();
|
||||
|
||||
int channel(-1);
|
||||
CodecInst isac;
|
||||
int channel(-1);
|
||||
CodecInst isac;
|
||||
|
||||
isac.pltype = 104;
|
||||
strcpy(isac.plname, "ISAC");
|
||||
isac.pacsize = 960;
|
||||
isac.plfreq = 32000;
|
||||
isac.channels = 1;
|
||||
isac.rate = -1;
|
||||
isac.pltype = 104;
|
||||
strcpy(isac.plname, "ISAC");
|
||||
isac.pacsize = 960;
|
||||
isac.plfreq = 32000;
|
||||
isac.channels = 1;
|
||||
isac.rate = -1;
|
||||
|
||||
CHECK(base->Init());
|
||||
channel = base->CreateChannel();
|
||||
CHECK(base->Init());
|
||||
channel = base->CreateChannel();
|
||||
|
||||
CHECK(base->SetLocalReceiver(channel, 5566));
|
||||
CHECK(base->SetSendDestination(channel, 5566, "127.0.0.1"));
|
||||
CHECK(codec->SetRecPayloadType(channel, isac));
|
||||
CHECK(codec->SetSendCodec(channel, isac));
|
||||
CHECK(base->SetLocalReceiver(channel, 5566));
|
||||
CHECK(base->SetSendDestination(channel, 5566, "127.0.0.1"));
|
||||
CHECK(codec->SetRecPayloadType(channel, isac));
|
||||
CHECK(codec->SetSendCodec(channel, isac));
|
||||
|
||||
CHECK(base->StartReceive(channel));
|
||||
CHECK(base->StartPlayout(channel));
|
||||
CHECK(base->StartSend(channel));
|
||||
CHECK(file->StartPlayingFileAsMicrophone(channel, _mgr.AudioFilename(),
|
||||
true, true));
|
||||
CHECK(base->StartReceive(channel));
|
||||
CHECK(base->StartPlayout(channel));
|
||||
CHECK(base->StartSend(channel));
|
||||
CHECK(file->StartPlayingFileAsMicrophone(channel, _mgr.AudioFilename(),
|
||||
true, true));
|
||||
|
||||
CHECK(codec->SetVADStatus(channel, true));
|
||||
CHECK(apm->SetAgcStatus(true, kAgcAdaptiveAnalog));
|
||||
CHECK(apm->SetNsStatus(true, kNsModerateSuppression));
|
||||
CHECK(apm->SetEcStatus(true, kEcAec));
|
||||
CHECK(codec->SetVADStatus(channel, true));
|
||||
CHECK(apm->SetAgcStatus(true, kAgcAdaptiveAnalog));
|
||||
CHECK(apm->SetNsStatus(true, kNsModerateSuppression));
|
||||
CHECK(apm->SetEcStatus(true, kEcAec));
|
||||
|
||||
TEST_LOG("\nMeasure CPU and memory while running a full-duplex"
|
||||
" iSAC-swb call.\n\n");
|
||||
TEST_LOG("\nMeasure CPU and memory while running a full-duplex"
|
||||
" iSAC-swb call.\n\n");
|
||||
|
||||
PAUSE
|
||||
PAUSE
|
||||
|
||||
CHECK(base->StopSend(channel));
|
||||
CHECK(base->StopPlayout(channel));
|
||||
CHECK(base->StopReceive(channel));
|
||||
CHECK(base->StopSend(channel));
|
||||
CHECK(base->StopPlayout(channel));
|
||||
CHECK(base->StopReceive(channel));
|
||||
|
||||
base->DeleteChannel(channel);
|
||||
CHECK(base->Terminate());
|
||||
base->DeleteChannel(channel);
|
||||
CHECK(base->Terminate());
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace voetest
|
||||
} // namespace voetest
|
||||
|
@ -17,16 +17,15 @@ namespace voetest {
|
||||
|
||||
class VoETestManager;
|
||||
|
||||
class VoECpuTest
|
||||
{
|
||||
public:
|
||||
VoECpuTest(VoETestManager& mgr);
|
||||
~VoECpuTest() {};
|
||||
int DoTest();
|
||||
private:
|
||||
VoETestManager& _mgr;
|
||||
class VoECpuTest {
|
||||
public:
|
||||
VoECpuTest(VoETestManager& mgr);
|
||||
~VoECpuTest() {}
|
||||
int DoTest();
|
||||
private:
|
||||
VoETestManager& _mgr;
|
||||
};
|
||||
|
||||
} // namespace voetest
|
||||
} // namespace voetest
|
||||
|
||||
#endif // WEBRTC_VOICE_ENGINE_VOE_CPU_TEST_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,9 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
|
||||
// Helper methods which allows us to get some handy information about
|
||||
// this mock implementation.
|
||||
int32_t ReferenceCounter() const { return _ref_count; }
|
||||
int32_t ReferenceCounter() const {
|
||||
return _ref_count;
|
||||
}
|
||||
|
||||
// RefCountedModule implementation (mocks default implementation)
|
||||
virtual int32_t AddRef();
|
||||
@ -42,15 +44,28 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
|
||||
// Module implementation
|
||||
virtual int32_t Version(char* version,
|
||||
uint32_t& remaining_buffer_in_bytes, uint32_t& position) const { return 0;}
|
||||
virtual int32_t ChangeUniqueId(const int32_t id) { return 0; }
|
||||
virtual int32_t TimeUntilNextProcess() { return -1;}
|
||||
virtual int32_t Process() { return 0; }
|
||||
uint32_t& remaining_buffer_in_bytes,
|
||||
uint32_t& position) const {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t ChangeUniqueId(const int32_t id) {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t TimeUntilNextProcess() {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t Process() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// AudioDeviceModule implementation
|
||||
virtual int32_t ActiveAudioLayer(AudioLayer* audioLayer) const { return 0; }
|
||||
virtual int32_t ActiveAudioLayer(AudioLayer* audioLayer) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual ErrorCode LastError() const { return static_cast<ErrorCode> (0); }
|
||||
virtual ErrorCode LastError() const {
|
||||
return static_cast<ErrorCode> (0);
|
||||
}
|
||||
virtual int32_t RegisterEventObserver(AudioDeviceObserver* eventCallback) {
|
||||
return 0;
|
||||
}
|
||||
@ -59,148 +74,276 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int32_t Init() { return 0; }
|
||||
virtual int32_t Terminate() { return 0; }
|
||||
virtual bool Initialized() const { return true; }
|
||||
virtual int32_t Init() {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t Terminate() {
|
||||
return 0;
|
||||
}
|
||||
virtual bool Initialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual int16_t PlayoutDevices() { return -1; }
|
||||
virtual int16_t RecordingDevices() { return -1; }
|
||||
virtual int16_t PlayoutDevices() {
|
||||
return -1;
|
||||
}
|
||||
virtual int16_t RecordingDevices() {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t PlayoutDeviceName(uint16_t index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]) { return -1; }
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t RecordingDeviceName(uint16_t index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]) { return -1; }
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t SetPlayoutDevice(uint16_t index) { return 0; }
|
||||
virtual int32_t SetPlayoutDevice(WindowsDeviceType device) { return 0; }
|
||||
virtual int32_t SetRecordingDevice(uint16_t index) { return 0; }
|
||||
virtual int32_t SetRecordingDevice(WindowsDeviceType device) { return 0; }
|
||||
virtual int32_t SetPlayoutDevice(uint16_t index) {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t SetPlayoutDevice(WindowsDeviceType device) {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t SetRecordingDevice(uint16_t index) {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t SetRecordingDevice(WindowsDeviceType device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int32_t PlayoutIsAvailable(bool* available) {
|
||||
*available = true;
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t InitPlayout() { return 0; }
|
||||
virtual bool PlayoutIsInitialized() const { return true; }
|
||||
virtual int32_t InitPlayout() {
|
||||
return 0;
|
||||
}
|
||||
virtual bool PlayoutIsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
virtual int32_t RecordingIsAvailable(bool* available) {
|
||||
*available = true;
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t InitRecording() { return 0; }
|
||||
virtual bool RecordingIsInitialized() const { return true; }
|
||||
virtual int32_t InitRecording() {
|
||||
return 0;
|
||||
}
|
||||
virtual bool RecordingIsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual int32_t StartPlayout() { return 0; }
|
||||
virtual int32_t StopPlayout() { return 0; }
|
||||
virtual bool Playing() const { return true; }
|
||||
virtual int32_t StartRecording() { return 0; }
|
||||
virtual int32_t StopRecording() { return 0; }
|
||||
virtual bool Recording() const { return true; }
|
||||
virtual int32_t StartPlayout() {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t StopPlayout() {
|
||||
return 0;
|
||||
}
|
||||
virtual bool Playing() const {
|
||||
return true;
|
||||
}
|
||||
virtual int32_t StartRecording() {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t StopRecording() {
|
||||
return 0;
|
||||
}
|
||||
virtual bool Recording() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual int32_t SetAGC(bool enable) { return -1; }
|
||||
virtual bool AGC() const { return false; }
|
||||
virtual int32_t SetAGC(bool enable) {
|
||||
return -1;
|
||||
}
|
||||
virtual bool AGC() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual int32_t SetWaveOutVolume(uint16_t volumeLeft,
|
||||
uint16_t volumeRight) { return -1; }
|
||||
uint16_t volumeRight) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t WaveOutVolume(uint16_t* volumeLeft,
|
||||
uint16_t* volumeRight) const { return -1; }
|
||||
uint16_t* volumeRight) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t SpeakerIsAvailable(bool* available) {
|
||||
*available = true;
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t InitSpeaker() { return 0; }
|
||||
virtual bool SpeakerIsInitialized() const { return true; }
|
||||
virtual int32_t InitSpeaker() {
|
||||
return 0;
|
||||
}
|
||||
virtual bool SpeakerIsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
virtual int32_t MicrophoneIsAvailable(bool* available) {
|
||||
*available = true;
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t InitMicrophone() { return 0; }
|
||||
virtual bool MicrophoneIsInitialized() const { return true; }
|
||||
virtual int32_t InitMicrophone() {
|
||||
return 0;
|
||||
}
|
||||
virtual bool MicrophoneIsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual int32_t SpeakerVolumeIsAvailable(bool* available) { return -1; }
|
||||
virtual int32_t SetSpeakerVolume(uint32_t volume) { return -1; }
|
||||
virtual int32_t SpeakerVolume(uint32_t* volume) const { return -1; }
|
||||
virtual int32_t MaxSpeakerVolume(uint32_t* maxVolume) const { return -1; }
|
||||
virtual int32_t MinSpeakerVolume(uint32_t* minVolume) const { return -1; }
|
||||
virtual int32_t SpeakerVolumeStepSize(uint16_t* stepSize) const {
|
||||
virtual int32_t SpeakerVolumeIsAvailable(bool* available) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetSpeakerVolume(uint32_t volume) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SpeakerVolume(uint32_t* volume) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t MaxSpeakerVolume(uint32_t* maxVolume) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t MinSpeakerVolume(uint32_t* minVolume) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SpeakerVolumeStepSize(uint16_t* stepSize) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t MicrophoneVolumeIsAvailable(bool* available) { return -1; }
|
||||
virtual int32_t SetMicrophoneVolume(uint32_t volume) { return -1; }
|
||||
virtual int32_t MicrophoneVolume(uint32_t* volume) const { return -1; }
|
||||
virtual int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const { return -1; }
|
||||
virtual int32_t MinMicrophoneVolume(uint32_t* minVolume) const { return -1; }
|
||||
virtual int32_t MicrophoneVolumeStepSize(uint16_t* stepSize) const {
|
||||
virtual int32_t MicrophoneVolumeIsAvailable(bool* available) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetMicrophoneVolume(uint32_t volume) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t MicrophoneVolume(uint32_t* volume) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t MinMicrophoneVolume(uint32_t* minVolume) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t MicrophoneVolumeStepSize(uint16_t* stepSize) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t SpeakerMuteIsAvailable(bool* available) { return -1; }
|
||||
virtual int32_t SetSpeakerMute(bool enable) { return -1; }
|
||||
virtual int32_t SpeakerMute(bool* enabled) const { return -1; }
|
||||
virtual int32_t SpeakerMuteIsAvailable(bool* available) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetSpeakerMute(bool enable) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SpeakerMute(bool* enabled) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t MicrophoneMuteIsAvailable(bool* available) { return -1; }
|
||||
virtual int32_t SetMicrophoneMute(bool enable) { return -1; }
|
||||
virtual int32_t MicrophoneMute(bool* enabled) const { return -1; }
|
||||
virtual int32_t MicrophoneMuteIsAvailable(bool* available) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetMicrophoneMute(bool enable) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t MicrophoneMute(bool* enabled) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t MicrophoneBoostIsAvailable(bool* available) { return -1; }
|
||||
virtual int32_t SetMicrophoneBoost(bool enable) { return -1; }
|
||||
virtual int32_t MicrophoneBoost(bool* enabled) const { return -1; }
|
||||
virtual int32_t MicrophoneBoostIsAvailable(bool* available) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetMicrophoneBoost(bool enable) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t MicrophoneBoost(bool* enabled) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t StereoPlayoutIsAvailable(bool* available) const {
|
||||
return -1; }
|
||||
virtual int32_t SetStereoPlayout(bool enable) { return -1; }
|
||||
virtual int32_t StereoPlayout(bool* enabled) const { return -1; }
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetStereoPlayout(bool enable) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t StereoPlayout(bool* enabled) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t StereoRecordingIsAvailable(bool* available) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetStereoRecording(bool enable) { return -1; }
|
||||
virtual int32_t StereoRecording(bool* enabled) const { return -1; }
|
||||
virtual int32_t SetStereoRecording(bool enable) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t StereoRecording(bool* enabled) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetRecordingChannel(const ChannelType channel) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t RecordingChannel(ChannelType* channel) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t RecordingChannel(ChannelType* channel) const { return -1; }
|
||||
|
||||
virtual int32_t SetPlayoutBuffer(const BufferType type,
|
||||
uint16_t sizeMS = 0) { return -1; }
|
||||
virtual int32_t SetPlayoutBuffer(const BufferType type, uint16_t sizeMS = 0) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t PlayoutBuffer(BufferType* type, uint16_t* sizeMS) const {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t PlayoutDelay(uint16_t* delayMS) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t RecordingDelay(uint16_t* delayMS) const {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t PlayoutDelay(uint16_t* delayMS) const { return -1; }
|
||||
virtual int32_t RecordingDelay(uint16_t* delayMS) const { return -1; }
|
||||
|
||||
virtual int32_t CPULoad(uint16_t* load) const { return -1; }
|
||||
virtual int32_t CPULoad(uint16_t* load) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t StartRawOutputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { return -1; }
|
||||
virtual int32_t StopRawOutputFileRecording() { return -1; }
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t StopRawOutputFileRecording() {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t StartRawInputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { return -1; }
|
||||
virtual int32_t StopRawInputFileRecording() { return -1; }
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t StopRawInputFileRecording() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t RecordingSampleRate(uint32_t* samplesPerSec) const {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetPlayoutSampleRate(const uint32_t samplesPerSec) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t PlayoutSampleRate(uint32_t* samplesPerSec) const {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual int32_t ResetAudioDevice() { return -1; }
|
||||
virtual int32_t SetLoudspeakerStatus(bool enable) { return -1; }
|
||||
virtual int32_t GetLoudspeakerStatus(bool* enabled) const { return -1; }
|
||||
virtual int32_t ResetAudioDevice() {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t SetLoudspeakerStatus(bool enable) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t GetLoudspeakerStatus(bool* enabled) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
AudioDeviceModuleImpl();
|
||||
~AudioDeviceModuleImpl();
|
||||
|
||||
private:
|
||||
private:
|
||||
volatile int32_t _ref_count;
|
||||
};
|
||||
|
||||
@ -208,51 +351,53 @@ private:
|
||||
// Transport
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ExtendedTestTransport : public Transport
|
||||
{
|
||||
public:
|
||||
ExtendedTestTransport(VoENetwork* ptr);
|
||||
~ExtendedTestTransport();
|
||||
VoENetwork* myNetw;
|
||||
protected:
|
||||
virtual int SendPacket(int channel,const void *data,int len);
|
||||
virtual int SendRTCPPacket(int channel, const void *data, int len);
|
||||
private:
|
||||
static bool Run(void* ptr);
|
||||
bool Process();
|
||||
private:
|
||||
ThreadWrapper* _thread;
|
||||
CriticalSectionWrapper* _lock;
|
||||
EventWrapper* _event;
|
||||
private:
|
||||
unsigned char _packetBuffer[1612];
|
||||
int _length;
|
||||
int _channel;
|
||||
class ExtendedTestTransport : public Transport {
|
||||
public:
|
||||
ExtendedTestTransport(VoENetwork* ptr);
|
||||
~ExtendedTestTransport();
|
||||
VoENetwork* myNetw;
|
||||
|
||||
protected:
|
||||
virtual int SendPacket(int channel, const void *data, int len);
|
||||
virtual int SendRTCPPacket(int channel, const void *data, int len);
|
||||
|
||||
private:
|
||||
static bool Run(void* ptr);
|
||||
bool Process();
|
||||
|
||||
private:
|
||||
ThreadWrapper* _thread;
|
||||
CriticalSectionWrapper* _lock;
|
||||
EventWrapper* _event;
|
||||
|
||||
private:
|
||||
unsigned char _packetBuffer[1612];
|
||||
int _length;
|
||||
int _channel;
|
||||
};
|
||||
|
||||
class XTransport : public Transport
|
||||
{
|
||||
public:
|
||||
XTransport(VoENetwork* netw, VoEFile* file);
|
||||
VoENetwork* _netw;
|
||||
VoEFile* _file;
|
||||
public:
|
||||
virtual int SendPacket(int channel, const void *data, int len);
|
||||
virtual int SendRTCPPacket(int channel, const void *data, int len);
|
||||
class XTransport : public Transport {
|
||||
public:
|
||||
XTransport(VoENetwork* netw, VoEFile* file);
|
||||
VoENetwork* _netw;
|
||||
VoEFile* _file;
|
||||
|
||||
public:
|
||||
virtual int SendPacket(int channel, const void *data, int len);
|
||||
virtual int SendRTCPPacket(int channel, const void *data, int len);
|
||||
};
|
||||
|
||||
class XRTPObserver : public VoERTPObserver
|
||||
{
|
||||
public:
|
||||
XRTPObserver();
|
||||
~XRTPObserver();
|
||||
virtual void OnIncomingCSRCChanged(const int channel,
|
||||
const unsigned int CSRC,
|
||||
const bool added);
|
||||
virtual void OnIncomingSSRCChanged(const int channel,
|
||||
const unsigned int SSRC);
|
||||
public:
|
||||
unsigned int _SSRC;
|
||||
class XRTPObserver : public VoERTPObserver {
|
||||
public:
|
||||
XRTPObserver();
|
||||
~XRTPObserver();
|
||||
virtual void OnIncomingCSRCChanged(const int channel,
|
||||
const unsigned int CSRC,
|
||||
const bool added);
|
||||
virtual void OnIncomingSSRCChanged(const int channel,
|
||||
const unsigned int SSRC);
|
||||
public:
|
||||
unsigned int _SSRC;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -260,72 +405,57 @@ public:
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class VoEExtendedTest : public VoiceEngineObserver,
|
||||
public VoEConnectionObserver
|
||||
{
|
||||
public:
|
||||
VoEExtendedTest(VoETestManager& mgr);
|
||||
~VoEExtendedTest();
|
||||
int PrepareTest(const char* str) const;
|
||||
int TestPassed(const char* str) const;
|
||||
int TestBase();
|
||||
int TestCallReport();
|
||||
int TestCodec();
|
||||
int TestDtmf();
|
||||
int TestEncryption();
|
||||
int TestExternalMedia();
|
||||
int TestFile();
|
||||
int TestMixing();
|
||||
int TestHardware();
|
||||
int TestNetEqStats();
|
||||
int TestNetwork();
|
||||
int TestRTP_RTCP();
|
||||
int TestVideoSync();
|
||||
int TestVolumeControl();
|
||||
int TestAPM();
|
||||
public:
|
||||
int ErrorCode() const
|
||||
{
|
||||
return _errCode;
|
||||
}
|
||||
;
|
||||
void ClearErrorCode()
|
||||
{
|
||||
_errCode = 0;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
// from VoiceEngineObserver
|
||||
void CallbackOnError(const int errCode, const int channel);
|
||||
void CallbackOnTrace(const TraceLevel level,
|
||||
const char* message,
|
||||
const int length);
|
||||
protected:
|
||||
// from VoEConnectionObserver
|
||||
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
||||
private:
|
||||
void Play(int channel,
|
||||
unsigned int timeMillisec,
|
||||
bool addFileAsMicrophone = false,
|
||||
bool addTimeMarker = false);
|
||||
void Sleep(unsigned int timeMillisec, bool addMarker = false);
|
||||
void StartMedia(int channel,
|
||||
int rtpPort,
|
||||
bool listen,
|
||||
bool playout,
|
||||
bool send);
|
||||
void StopMedia(int channel);
|
||||
int RunMixingTest(int num_channels,
|
||||
int16_t input_value,
|
||||
int16_t max_output_value,
|
||||
int16_t min_output_value);
|
||||
private:
|
||||
VoETestManager& _mgr;
|
||||
private:
|
||||
int _errCode;
|
||||
bool _alive;
|
||||
bool _listening[32];
|
||||
bool _playing[32];
|
||||
bool _sending[32];
|
||||
public VoEConnectionObserver {
|
||||
public:
|
||||
VoEExtendedTest(VoETestManager& mgr);
|
||||
~VoEExtendedTest();
|
||||
int PrepareTest(const char* str) const;
|
||||
int TestPassed(const char* str) const;
|
||||
int TestBase();
|
||||
int TestCallReport();
|
||||
int TestCodec();
|
||||
int TestDtmf();
|
||||
int TestEncryption();
|
||||
int TestExternalMedia();
|
||||
int TestFile();
|
||||
int TestMixing();
|
||||
int TestHardware();
|
||||
int TestNetEqStats();
|
||||
int TestNetwork();
|
||||
int TestRTP_RTCP();
|
||||
int TestVideoSync();
|
||||
int TestVolumeControl();
|
||||
int TestAPM();
|
||||
public:
|
||||
int ErrorCode() const {
|
||||
return _errCode;
|
||||
}
|
||||
void ClearErrorCode() {
|
||||
_errCode = 0;
|
||||
}
|
||||
protected:
|
||||
// from VoiceEngineObserver
|
||||
void CallbackOnError(const int errCode, const int channel);
|
||||
void CallbackOnTrace(const TraceLevel level, const char* message, const int length);
|
||||
protected:
|
||||
// from VoEConnectionObserver
|
||||
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
||||
private:
|
||||
void Play(int channel, unsigned int timeMillisec, bool addFileAsMicrophone = false,
|
||||
bool addTimeMarker = false);
|
||||
void Sleep(unsigned int timeMillisec, bool addMarker = false);
|
||||
void StartMedia(int channel, int rtpPort, bool listen, bool playout, bool send);
|
||||
void StopMedia(int channel);
|
||||
int RunMixingTest(int num_channels, int16_t input_value, int16_t max_output_value,
|
||||
int16_t min_output_value);
|
||||
private:
|
||||
VoETestManager& _mgr;
|
||||
private:
|
||||
int _errCode;
|
||||
bool _alive;
|
||||
bool _listening[32];
|
||||
bool _playing[32];
|
||||
bool _sending[32];
|
||||
};
|
||||
|
||||
} // namespace voetest
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -49,8 +49,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef _TEST_NETEQ_STATS_
|
||||
namespace webrtc
|
||||
{
|
||||
namespace webrtc {
|
||||
class CriticalSectionWrapper;
|
||||
class ThreadWrapper;
|
||||
class VoENetEqStats;
|
||||
@ -61,327 +60,301 @@ class VoENetEqStats;
|
||||
extern char mobileLogMsg[640];
|
||||
#endif
|
||||
|
||||
namespace voetest
|
||||
{
|
||||
namespace voetest {
|
||||
|
||||
void createSummary(VoiceEngine* ve);
|
||||
void prepareDelivery();
|
||||
|
||||
class MyRTPObserver: public VoERTPObserver
|
||||
{
|
||||
public:
|
||||
MyRTPObserver();
|
||||
~MyRTPObserver();
|
||||
virtual void OnIncomingCSRCChanged(const int channel,
|
||||
const unsigned int CSRC,
|
||||
const bool added);
|
||||
virtual void OnIncomingSSRCChanged(const int channel,
|
||||
const unsigned int SSRC);
|
||||
void Reset();
|
||||
public:
|
||||
unsigned int _SSRC[2];
|
||||
unsigned int _CSRC[2][2]; // stores 2 SSRCs for each channel
|
||||
bool _added[2][2];
|
||||
int _size[2];
|
||||
class MyRTPObserver : public VoERTPObserver {
|
||||
public:
|
||||
MyRTPObserver();
|
||||
~MyRTPObserver();
|
||||
virtual void OnIncomingCSRCChanged(const int channel,
|
||||
const unsigned int CSRC,
|
||||
const bool added);
|
||||
virtual void OnIncomingSSRCChanged(const int channel,
|
||||
const unsigned int SSRC);
|
||||
void Reset();
|
||||
public:
|
||||
unsigned int _SSRC[2];
|
||||
unsigned int _CSRC[2][2]; // stores 2 SSRCs for each channel
|
||||
bool _added[2][2];
|
||||
int _size[2];
|
||||
};
|
||||
|
||||
class MyTraceCallback: public TraceCallback
|
||||
{
|
||||
public:
|
||||
void Print(const TraceLevel level, const char *traceString,
|
||||
const int length);
|
||||
class MyTraceCallback : public TraceCallback {
|
||||
public:
|
||||
void Print(const TraceLevel level, const char *traceString, const int length);
|
||||
};
|
||||
|
||||
class MyDeadOrAlive: public VoEConnectionObserver
|
||||
{
|
||||
public:
|
||||
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
||||
class MyDeadOrAlive : public VoEConnectionObserver {
|
||||
public:
|
||||
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
||||
};
|
||||
|
||||
class ErrorObserver: public VoiceEngineObserver
|
||||
{
|
||||
public:
|
||||
ErrorObserver();
|
||||
void CallbackOnError(const int channel, const int errCode);
|
||||
public:
|
||||
int code;
|
||||
class ErrorObserver : public VoiceEngineObserver {
|
||||
public:
|
||||
ErrorObserver();
|
||||
void CallbackOnError(const int channel, const int errCode);
|
||||
public:
|
||||
int code;
|
||||
};
|
||||
|
||||
class RtcpAppHandler: public VoERTCPObserver
|
||||
{
|
||||
public:
|
||||
void OnApplicationDataReceived(const int channel,
|
||||
const unsigned char subType,
|
||||
const unsigned int name,
|
||||
const unsigned char* data,
|
||||
const unsigned short dataLengthInBytes);
|
||||
void Reset();
|
||||
~RtcpAppHandler()
|
||||
{
|
||||
};
|
||||
unsigned short _lengthBytes;
|
||||
unsigned char _data[256];
|
||||
unsigned char _subType;
|
||||
unsigned int _name;
|
||||
class RtcpAppHandler : public VoERTCPObserver {
|
||||
public:
|
||||
void OnApplicationDataReceived(const int channel,
|
||||
const unsigned char subType,
|
||||
const unsigned int name,
|
||||
const unsigned char* data,
|
||||
const unsigned short dataLengthInBytes);
|
||||
void Reset();
|
||||
~RtcpAppHandler() {}
|
||||
unsigned short _lengthBytes;
|
||||
unsigned char _data[256];
|
||||
unsigned char _subType;
|
||||
unsigned int _name;
|
||||
};
|
||||
|
||||
class DtmfCallback: public VoETelephoneEventObserver
|
||||
{
|
||||
public:
|
||||
int counter;
|
||||
DtmfCallback()
|
||||
{
|
||||
counter = 0;
|
||||
}
|
||||
virtual void OnReceivedTelephoneEventInband(int channel,
|
||||
int eventCode,
|
||||
bool endOfEvent)
|
||||
{
|
||||
char msg[128];
|
||||
if (endOfEvent)
|
||||
sprintf(msg, "(event=%d, [END])", eventCode);
|
||||
else
|
||||
sprintf(msg, "(event=%d, [START])", eventCode);
|
||||
TEST_LOG("%s", msg);
|
||||
if (!endOfEvent)
|
||||
counter++; // cound start of event only
|
||||
fflush(NULL);
|
||||
}
|
||||
class DtmfCallback : public VoETelephoneEventObserver {
|
||||
public:
|
||||
int counter;
|
||||
DtmfCallback() {
|
||||
counter = 0;
|
||||
}
|
||||
virtual void OnReceivedTelephoneEventInband(int channel,
|
||||
int eventCode,
|
||||
bool endOfEvent) {
|
||||
char msg[128];
|
||||
if (endOfEvent)
|
||||
sprintf(msg, "(event=%d, [END])", eventCode);
|
||||
else
|
||||
sprintf(msg, "(event=%d, [START])", eventCode);
|
||||
TEST_LOG("%s", msg);
|
||||
if (!endOfEvent)
|
||||
counter++; // cound start of event only
|
||||
fflush(NULL);
|
||||
}
|
||||
|
||||
virtual void OnReceivedTelephoneEventOutOfBand(
|
||||
int channel,
|
||||
int eventCode,
|
||||
bool endOfEvent)
|
||||
{
|
||||
char msg[128];
|
||||
if (endOfEvent)
|
||||
sprintf(msg, "(event=%d, [END])", eventCode);
|
||||
else
|
||||
sprintf(msg, "(event=%d, [START])", eventCode);
|
||||
TEST_LOG("%s", msg);
|
||||
if (!endOfEvent)
|
||||
counter++; // cound start of event only
|
||||
fflush(NULL);
|
||||
}
|
||||
virtual void OnReceivedTelephoneEventOutOfBand(int channel,
|
||||
int eventCode,
|
||||
bool endOfEvent) {
|
||||
char msg[128];
|
||||
if (endOfEvent)
|
||||
sprintf(msg, "(event=%d, [END])", eventCode);
|
||||
else
|
||||
sprintf(msg, "(event=%d, [START])", eventCode);
|
||||
TEST_LOG("%s", msg);
|
||||
if (!endOfEvent)
|
||||
counter++; // cound start of event only
|
||||
fflush(NULL);
|
||||
}
|
||||
};
|
||||
|
||||
class my_encryption: public Encryption
|
||||
{
|
||||
void encrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void decrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void encrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void decrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
class my_encryption : public Encryption {
|
||||
void encrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void decrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void encrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void decrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
};
|
||||
|
||||
class RxCallback: public VoERxVadCallback
|
||||
{
|
||||
public:
|
||||
RxCallback() :
|
||||
_vadDecision(-1)
|
||||
{
|
||||
};
|
||||
class RxCallback : public VoERxVadCallback {
|
||||
public:
|
||||
RxCallback() :
|
||||
_vadDecision(-1) {
|
||||
}
|
||||
|
||||
virtual void OnRxVad(int, int vadDecision)
|
||||
{
|
||||
char msg[128];
|
||||
sprintf(msg, "RX VAD detected decision %d \n", vadDecision);
|
||||
TEST_LOG("%s", msg);
|
||||
_vadDecision = vadDecision;
|
||||
}
|
||||
virtual void OnRxVad(int, int vadDecision) {
|
||||
char msg[128];
|
||||
sprintf(msg, "RX VAD detected decision %d \n", vadDecision);
|
||||
TEST_LOG("%s", msg);
|
||||
_vadDecision = vadDecision;
|
||||
}
|
||||
|
||||
int _vadDecision;
|
||||
int _vadDecision;
|
||||
};
|
||||
|
||||
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
|
||||
class MyMedia: public VoEMediaProcess
|
||||
{
|
||||
public:
|
||||
virtual void Process(const int channel, const ProcessingTypes type,
|
||||
WebRtc_Word16 audio_10ms[], const int length,
|
||||
const int samplingFreqHz, const bool stereo);
|
||||
private:
|
||||
int f;
|
||||
class MyMedia : public VoEMediaProcess {
|
||||
public:
|
||||
virtual void Process(const int channel,
|
||||
const ProcessingTypes type,
|
||||
WebRtc_Word16 audio_10ms[],
|
||||
const int length,
|
||||
const int samplingFreqHz,
|
||||
const bool stereo);
|
||||
private:
|
||||
int f;
|
||||
};
|
||||
#endif
|
||||
|
||||
class SubAPIManager
|
||||
{
|
||||
public:
|
||||
SubAPIManager() :
|
||||
_base(true),
|
||||
_callReport(false),
|
||||
_codec(false),
|
||||
_dtmf(false),
|
||||
_encryption(false),
|
||||
_externalMedia(false),
|
||||
_file(false),
|
||||
_hardware(false),
|
||||
_netEqStats(false),
|
||||
_network(false),
|
||||
_rtp_rtcp(false),
|
||||
_videoSync(false),
|
||||
_volumeControl(false),
|
||||
_apm(false),
|
||||
_xsel(XSEL_Invalid)
|
||||
{
|
||||
class SubAPIManager {
|
||||
public:
|
||||
SubAPIManager()
|
||||
: _base(true),
|
||||
_callReport(false),
|
||||
_codec(false),
|
||||
_dtmf(false),
|
||||
_encryption(false),
|
||||
_externalMedia(false),
|
||||
_file(false),
|
||||
_hardware(false),
|
||||
_netEqStats(false),
|
||||
_network(false),
|
||||
_rtp_rtcp(false),
|
||||
_videoSync(false),
|
||||
_volumeControl(false),
|
||||
_apm(false),
|
||||
_xsel(XSEL_Invalid) {
|
||||
#ifdef WEBRTC_VOICE_ENGINE_CALL_REPORT_API
|
||||
_callReport = true;
|
||||
_callReport = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
|
||||
_codec = true;
|
||||
_codec = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
|
||||
_dtmf = true;
|
||||
_dtmf = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
|
||||
_encryption = true;
|
||||
_encryption = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
|
||||
_externalMedia = true;
|
||||
_externalMedia = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_FILE_API
|
||||
_file = true;
|
||||
_file = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
|
||||
_hardware = true;
|
||||
_hardware = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
|
||||
_netEqStats = true;
|
||||
_netEqStats = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_NETWORK_API
|
||||
_network = true;
|
||||
_network = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
|
||||
_rtp_rtcp = true;
|
||||
_rtp_rtcp = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
|
||||
_videoSync = true;
|
||||
_videoSync = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
|
||||
_volumeControl = true;
|
||||
_volumeControl = true;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
|
||||
_apm = true;
|
||||
_apm = true;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
void DisplayStatus() const;
|
||||
bool GetExtendedMenuSelection(ExtendedSelection& sel);
|
||||
void DisplayStatus() const;
|
||||
bool GetExtendedMenuSelection(ExtendedSelection& sel);
|
||||
|
||||
private:
|
||||
bool _base, _callReport, _codec, _dtmf, _encryption;
|
||||
bool _externalMedia, _file, _hardware;
|
||||
bool _netEqStats, _network, _rtp_rtcp, _videoSync, _volumeControl, _apm;
|
||||
ExtendedSelection _xsel;
|
||||
private:
|
||||
bool _base, _callReport, _codec, _dtmf, _encryption;
|
||||
bool _externalMedia, _file, _hardware;
|
||||
bool _netEqStats, _network, _rtp_rtcp, _videoSync, _volumeControl, _apm;
|
||||
ExtendedSelection _xsel;
|
||||
};
|
||||
|
||||
class VoETestManager
|
||||
{
|
||||
public:
|
||||
VoETestManager();
|
||||
~VoETestManager();
|
||||
class VoETestManager {
|
||||
public:
|
||||
VoETestManager();
|
||||
~VoETestManager();
|
||||
|
||||
// Must be called after construction.
|
||||
bool Init();
|
||||
// Must be called after construction.
|
||||
bool Init();
|
||||
|
||||
void GetInterfaces();
|
||||
int ReleaseInterfaces();
|
||||
int DoStandardTest();
|
||||
void GetInterfaces();
|
||||
int ReleaseInterfaces();
|
||||
int DoStandardTest();
|
||||
|
||||
const char* AudioFilename() const
|
||||
{
|
||||
return audioFilename_.c_str();
|
||||
}
|
||||
const char* AudioFilename() const {
|
||||
return audioFilename_.c_str();
|
||||
}
|
||||
|
||||
VoiceEngine* VoiceEnginePtr() const {
|
||||
return ve;
|
||||
}
|
||||
VoEBase* BasePtr() const {
|
||||
return base;
|
||||
}
|
||||
VoECodec* CodecPtr() const {
|
||||
return codec;
|
||||
}
|
||||
VoEVolumeControl* VolumeControlPtr() const {
|
||||
return volume;
|
||||
}
|
||||
VoEDtmf* DtmfPtr() const {
|
||||
return dtmf;
|
||||
}
|
||||
VoERTP_RTCP* RTP_RTCPPtr() const {
|
||||
return rtp_rtcp;
|
||||
}
|
||||
VoEAudioProcessing* APMPtr() const {
|
||||
return apm;
|
||||
}
|
||||
|
||||
VoENetwork* NetworkPtr() const {
|
||||
return netw;
|
||||
}
|
||||
|
||||
VoEFile* FilePtr() const {
|
||||
return file;
|
||||
}
|
||||
|
||||
VoEHardware* HardwarePtr() const {
|
||||
return hardware;
|
||||
}
|
||||
|
||||
VoEVideoSync* VideoSyncPtr() const {
|
||||
return vsync;
|
||||
}
|
||||
|
||||
VoEEncryption* EncryptionPtr() const {
|
||||
return encrypt;
|
||||
}
|
||||
|
||||
VoEExternalMedia* ExternalMediaPtr() const {
|
||||
return xmedia;
|
||||
}
|
||||
|
||||
VoECallReport* CallReportPtr() const {
|
||||
return report;
|
||||
}
|
||||
|
||||
VoiceEngine* VoiceEnginePtr() const
|
||||
{
|
||||
return ve;
|
||||
};
|
||||
VoEBase* BasePtr() const
|
||||
{
|
||||
return base;
|
||||
};
|
||||
VoECodec* CodecPtr() const
|
||||
{
|
||||
return codec;
|
||||
};
|
||||
VoEVolumeControl* VolumeControlPtr() const
|
||||
{
|
||||
return volume;
|
||||
};
|
||||
VoEDtmf* DtmfPtr() const
|
||||
{
|
||||
return dtmf;
|
||||
};
|
||||
VoERTP_RTCP* RTP_RTCPPtr() const
|
||||
{
|
||||
return rtp_rtcp;
|
||||
};
|
||||
VoEAudioProcessing* APMPtr() const
|
||||
{
|
||||
return apm;
|
||||
};
|
||||
VoENetwork* NetworkPtr() const
|
||||
{
|
||||
return netw;
|
||||
};
|
||||
VoEFile* FilePtr() const
|
||||
{
|
||||
return file;
|
||||
};
|
||||
VoEHardware* HardwarePtr() const
|
||||
{
|
||||
return hardware;
|
||||
};
|
||||
VoEVideoSync* VideoSyncPtr() const
|
||||
{
|
||||
return vsync;
|
||||
};
|
||||
VoEEncryption* EncryptionPtr() const
|
||||
{
|
||||
return encrypt;
|
||||
};
|
||||
VoEExternalMedia* ExternalMediaPtr() const
|
||||
{
|
||||
return xmedia;
|
||||
};
|
||||
VoECallReport* CallReportPtr() const
|
||||
{
|
||||
return report;
|
||||
};
|
||||
#ifdef _TEST_NETEQ_STATS_
|
||||
VoENetEqStats* NetEqStatsPtr() const
|
||||
{
|
||||
return neteqst;
|
||||
};
|
||||
VoENetEqStats* NetEqStatsPtr() const {
|
||||
return neteqst;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
bool initialized_;
|
||||
VoiceEngine* ve;
|
||||
VoEBase* base;
|
||||
VoECallReport* report;
|
||||
VoECodec* codec;
|
||||
VoEDtmf* dtmf;
|
||||
VoEEncryption* encrypt;
|
||||
VoEExternalMedia* xmedia;
|
||||
VoEFile* file;
|
||||
VoEHardware* hardware;
|
||||
private:
|
||||
bool initialized_;
|
||||
VoiceEngine* ve;
|
||||
VoEBase* base;
|
||||
VoECallReport* report;
|
||||
VoECodec* codec;
|
||||
VoEDtmf* dtmf;
|
||||
VoEEncryption* encrypt;
|
||||
VoEExternalMedia* xmedia;
|
||||
VoEFile* file;
|
||||
VoEHardware* hardware;
|
||||
#ifdef _TEST_NETEQ_STATS_
|
||||
VoENetEqStats* neteqst;
|
||||
VoENetEqStats* neteqst;
|
||||
#endif
|
||||
VoENetwork* netw;
|
||||
VoERTP_RTCP* rtp_rtcp;
|
||||
VoEVideoSync* vsync;
|
||||
VoEVolumeControl* volume;
|
||||
VoEAudioProcessing* apm;
|
||||
int instanceCount;
|
||||
std::string resourcePath_;
|
||||
std::string audioFilename_;
|
||||
VoENetwork* netw;
|
||||
VoERTP_RTCP* rtp_rtcp;
|
||||
VoEVideoSync* vsync;
|
||||
VoEVolumeControl* volume;
|
||||
VoEAudioProcessing* apm;
|
||||
int instanceCount;
|
||||
std::string resourcePath_;
|
||||
std::string audioFilename_;
|
||||
};
|
||||
|
||||
} // namespace voetest
|
||||
|
@ -19,14 +19,13 @@
|
||||
#include <time.h>
|
||||
#include <cassert>
|
||||
#if defined(_WIN32)
|
||||
#include <conio.h>
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
#include "voe_stress_test.h"
|
||||
#include "voe_standard_test.h"
|
||||
|
||||
#include "../../source/voice_engine_defines.h" // defines build macros
|
||||
|
||||
#include "thread_wrapper.h"
|
||||
|
||||
using namespace webrtc;
|
||||
@ -41,11 +40,11 @@ namespace voetest {
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Pause if supported
|
||||
#define PAUSE_OR_SLEEP(x) PAUSE;
|
||||
// Pause if supported
|
||||
#define PAUSE_OR_SLEEP(x) PAUSE;
|
||||
#else
|
||||
// Sleep a bit instead if pause not supported
|
||||
#define PAUSE_OR_SLEEP(x) SLEEP(x);
|
||||
// Sleep a bit instead if pause not supported
|
||||
#define PAUSE_OR_SLEEP(x) SLEEP(x);
|
||||
#endif
|
||||
|
||||
extern char* GetFilename(char* filename);
|
||||
@ -54,400 +53,363 @@ extern int GetResource(char* resource, char* dest, int destLen);
|
||||
extern char* GetResource(char* resource);
|
||||
extern const char* GetResource(const char* resource);
|
||||
|
||||
|
||||
const char* VoEStressTest::_key = "====YUtFWRAAAAADBtIHgAAAAAEAAAAcAAAAAQBHU0ds"
|
||||
"b2JhbCBJUCBTb3VuZAAC\nAAAAIwAAAExpY2Vuc2VkIHRvIE5vcnRlbCBOZXR3cm9rcwAAAAA"
|
||||
"xAAAAZxZ7/u0M\niFYyTwSwko5Uutf7mh8S0O4rYZYTFidbzQeuGonuL17F/2oD/2pfDp3jL4"
|
||||
"Rf3z/A\nnlJsEJgEtASkDNFuwLILjGY0pzjjAYQp3pCl6z6k2MtE06AirdjGLYCjENpq/opX"
|
||||
"\nOrs3sIuwdYK5va/aFcsjBDmlsGCUM48RDYG9s23bIHYafXUC4ofOaubbZPWiPTmL\nEVJ8WH"
|
||||
"4F9pgNjALc14oJXfON7r/3\n=EsLx";
|
||||
"b2JhbCBJUCBTb3VuZAAC\nAAAAIwAAAExpY2Vuc2VkIHRvIE5vcnRlbCBOZXR3cm9rcwAAAAA"
|
||||
"xAAAAZxZ7/u0M\niFYyTwSwko5Uutf7mh8S0O4rYZYTFidbzQeuGonuL17F/2oD/2pfDp3jL4"
|
||||
"Rf3z/A\nnlJsEJgEtASkDNFuwLILjGY0pzjjAYQp3pCl6z6k2MtE06AirdjGLYCjENpq/opX"
|
||||
"\nOrs3sIuwdYK5va/aFcsjBDmlsGCUM48RDYG9s23bIHYafXUC4ofOaubbZPWiPTmL\nEVJ8WH"
|
||||
"4F9pgNjALc14oJXfON7r/3\n=EsLx";
|
||||
|
||||
int VoEStressTest::DoTest() {
|
||||
int test(-1);
|
||||
while (test != 0) {
|
||||
test = MenuSelection();
|
||||
switch (test) {
|
||||
case 0:
|
||||
// Quit stress test
|
||||
break;
|
||||
case 1:
|
||||
// All tests
|
||||
StartStopTest();
|
||||
CreateDeleteChannelsTest();
|
||||
MultipleThreadsTest();
|
||||
break;
|
||||
case 2:
|
||||
StartStopTest();
|
||||
break;
|
||||
case 3:
|
||||
CreateDeleteChannelsTest();
|
||||
break;
|
||||
case 4:
|
||||
MultipleThreadsTest();
|
||||
break;
|
||||
default:
|
||||
// Should not be possible
|
||||
printf("Invalid selection! (Test code error)\n");
|
||||
assert(false);
|
||||
} // switch
|
||||
} // while
|
||||
|
||||
int VoEStressTest::DoTest()
|
||||
{
|
||||
int test(-1);
|
||||
while (test != 0)
|
||||
{
|
||||
test = MenuSelection();
|
||||
switch (test)
|
||||
{
|
||||
case 0:
|
||||
// Quit stress test
|
||||
break;
|
||||
case 1:
|
||||
// All tests
|
||||
StartStopTest();
|
||||
CreateDeleteChannelsTest();
|
||||
MultipleThreadsTest();
|
||||
break;
|
||||
case 2:
|
||||
StartStopTest();
|
||||
break;
|
||||
case 3:
|
||||
CreateDeleteChannelsTest();
|
||||
break;
|
||||
case 4:
|
||||
MultipleThreadsTest();
|
||||
break;
|
||||
default:
|
||||
// Should not be possible
|
||||
printf("Invalid selection! (Test code error)\n");
|
||||
assert(false);
|
||||
} // switch
|
||||
} // while
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int VoEStressTest::MenuSelection() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Select stress test\n\n");
|
||||
printf(" (0) Quit\n");
|
||||
printf(" (1) All\n");
|
||||
printf("- - - - - - - - - - - - - - - - - - - - - - - - \n");
|
||||
printf(" (2) Start/stop\n");
|
||||
printf(" (3) Create/delete channels\n");
|
||||
printf(" (4) Multiple threads\n");
|
||||
|
||||
int VoEStressTest::MenuSelection()
|
||||
{
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Select stress test\n\n");
|
||||
printf(" (0) Quit\n");
|
||||
printf(" (1) All\n");
|
||||
printf("- - - - - - - - - - - - - - - - - - - - - - - - \n");
|
||||
printf(" (2) Start/stop\n");
|
||||
printf(" (3) Create/delete channels\n");
|
||||
printf(" (4) Multiple threads\n");
|
||||
const int maxMenuSelection = 4;
|
||||
int selection(-1);
|
||||
|
||||
const int maxMenuSelection = 4;
|
||||
int selection(-1);
|
||||
|
||||
while ((selection < 0) || (selection > maxMenuSelection))
|
||||
{
|
||||
printf("\n: ");
|
||||
int retval = scanf("%d", &selection);
|
||||
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection))
|
||||
{
|
||||
printf("Invalid selection!\n");
|
||||
}
|
||||
while ((selection < 0) || (selection > maxMenuSelection)) {
|
||||
printf("\n: ");
|
||||
int retval = scanf("%d", &selection);
|
||||
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection)) {
|
||||
printf("Invalid selection!\n");
|
||||
}
|
||||
}
|
||||
|
||||
return selection;
|
||||
return selection;
|
||||
}
|
||||
|
||||
int VoEStressTest::StartStopTest() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Running start/stop test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
|
||||
int VoEStressTest::StartStopTest()
|
||||
{
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Running start/stop test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
printf("\nNOTE: this thest will fail after a while if Core audio is used\n");
|
||||
printf("because MS returns AUDCLNT_E_CPUUSAGE_EXCEEDED (VoE Error 10013).\n");
|
||||
|
||||
printf("\nNOTE: this thest will fail after a while if Core audio is used\n");
|
||||
printf("because MS returns AUDCLNT_E_CPUUSAGE_EXCEEDED (VoE Error 10013).\n");
|
||||
// Get sub-API pointers
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
|
||||
// Get sub-API pointers
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
// Set trace
|
||||
// VALIDATE_STRESS(base->SetTraceFileName(
|
||||
// GetFilename("VoEStressTest_StartStop_trace.txt")));
|
||||
// VALIDATE_STRESS(base->SetDebugTraceFileName(
|
||||
// GetFilename("VoEStressTest_StartStop_trace_debug.txt")));
|
||||
// VALIDATE_STRESS(base->SetTraceFilter(kTraceStateInfo |
|
||||
// kTraceWarning | kTraceError |
|
||||
// kTraceCritical | kTraceApiCall |
|
||||
// kTraceMemory | kTraceInfo));
|
||||
VALIDATE_STRESS(base->Init());
|
||||
VALIDATE_STRESS(base->CreateChannel());
|
||||
|
||||
// Set trace
|
||||
// VALIDATE_STRESS(base->SetTraceFileName(
|
||||
// GetFilename("VoEStressTest_StartStop_trace.txt")));
|
||||
// VALIDATE_STRESS(base->SetDebugTraceFileName(
|
||||
// GetFilename("VoEStressTest_StartStop_trace_debug.txt")));
|
||||
// VALIDATE_STRESS(base->SetTraceFilter(kTraceStateInfo |
|
||||
// kTraceWarning | kTraceError |
|
||||
// kTraceCritical | kTraceApiCall |
|
||||
// kTraceMemory | kTraceInfo));
|
||||
///////////// Start test /////////////
|
||||
|
||||
VALIDATE_STRESS(base->Init());
|
||||
VALIDATE_STRESS(base->CreateChannel());
|
||||
int numberOfLoops(2000);
|
||||
int loopSleep(200);
|
||||
int i(0);
|
||||
int markInterval(20);
|
||||
|
||||
printf("Running %d loops with %d ms sleep. Mark every %d loop. \n",
|
||||
numberOfLoops, loopSleep, markInterval);
|
||||
printf("Test will take approximately %d minutes. \n",
|
||||
numberOfLoops * loopSleep / 1000 / 60 + 1);
|
||||
|
||||
///////////// Start test /////////////
|
||||
|
||||
int numberOfLoops(2000);
|
||||
int loopSleep(200);
|
||||
int i(0);
|
||||
int markInterval(20);
|
||||
|
||||
printf("Running %d loops with %d ms sleep. Mark every %d loop. \n",
|
||||
numberOfLoops, loopSleep, markInterval);
|
||||
printf("Test will take approximately %d minutes. \n",
|
||||
numberOfLoops*loopSleep/1000/60+1);
|
||||
|
||||
for (i=0; i<numberOfLoops; ++i)
|
||||
{
|
||||
VALIDATE_STRESS(base->SetLocalReceiver(0, 4800));
|
||||
VALIDATE_STRESS(base->SetSendDestination(0, 4800, "127.0.0.1"));
|
||||
VALIDATE_STRESS(base->StartReceive(0));
|
||||
VALIDATE_STRESS(base->StartPlayout(0));
|
||||
VALIDATE_STRESS(base->StartSend(0));
|
||||
if (!(i % markInterval)) MARK();
|
||||
SLEEP(loopSleep);
|
||||
VALIDATE_STRESS(base->StopSend(0));
|
||||
VALIDATE_STRESS(base->StopPlayout(0));
|
||||
VALIDATE_STRESS(base->StopReceive(0));
|
||||
}
|
||||
ANL();
|
||||
|
||||
for (i = 0; i < numberOfLoops; ++i) {
|
||||
VALIDATE_STRESS(base->SetLocalReceiver(0, 4800));
|
||||
VALIDATE_STRESS(base->SetSendDestination(0, 4800, "127.0.0.1"));
|
||||
VALIDATE_STRESS(base->StartReceive(0));
|
||||
VALIDATE_STRESS(base->StartPlayout(0));
|
||||
VALIDATE_STRESS(base->StartSend(0));
|
||||
printf("Verify that audio is good. \n");
|
||||
PAUSE_OR_SLEEP(20000);
|
||||
if (!(i % markInterval))
|
||||
MARK();
|
||||
SLEEP(loopSleep);
|
||||
VALIDATE_STRESS(base->StopSend(0));
|
||||
VALIDATE_STRESS(base->StopPlayout(0));
|
||||
VALIDATE_STRESS(base->StopReceive(0));
|
||||
}
|
||||
ANL();
|
||||
|
||||
///////////// End test /////////////
|
||||
VALIDATE_STRESS(base->SetLocalReceiver(0, 4800));
|
||||
VALIDATE_STRESS(base->SetSendDestination(0, 4800, "127.0.0.1"));
|
||||
VALIDATE_STRESS(base->StartReceive(0));
|
||||
VALIDATE_STRESS(base->StartPlayout(0));
|
||||
VALIDATE_STRESS(base->StartSend(0));
|
||||
printf("Verify that audio is good. \n");
|
||||
PAUSE_OR_SLEEP(20000);
|
||||
VALIDATE_STRESS(base->StopSend(0));
|
||||
VALIDATE_STRESS(base->StopPlayout(0));
|
||||
VALIDATE_STRESS(base->StopReceive(0));
|
||||
|
||||
///////////// End test /////////////
|
||||
|
||||
|
||||
// Terminate
|
||||
VALIDATE_STRESS(base->DeleteChannel(0));
|
||||
VALIDATE_STRESS(base->Terminate());
|
||||
// Terminate
|
||||
VALIDATE_STRESS(base->DeleteChannel(0));
|
||||
VALIDATE_STRESS(base->Terminate());
|
||||
|
||||
printf("Test finished \n");
|
||||
printf("Test finished \n");
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int VoEStressTest::CreateDeleteChannelsTest() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Running create/delete channels test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
|
||||
int VoEStressTest::CreateDeleteChannelsTest()
|
||||
{
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Running create/delete channels test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
// Get sub-API pointers
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
|
||||
// Get sub-API pointers
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
// Set trace
|
||||
// VALIDATE_STRESS(base->SetTraceFileName(
|
||||
// GetFilename("VoEStressTest_CreateChannels_trace.txt")));
|
||||
// VALIDATE_STRESS(base->SetDebugTraceFileName(
|
||||
// GetFilename("VoEStressTest_CreateChannels_trace_debug.txt")));
|
||||
// VALIDATE_STRESS(base->SetTraceFilter(kTraceStateInfo |
|
||||
// kTraceWarning | kTraceError |
|
||||
// kTraceCritical | kTraceApiCall |
|
||||
// kTraceMemory | kTraceInfo));
|
||||
VALIDATE_STRESS(base->Init());
|
||||
|
||||
// Set trace
|
||||
// VALIDATE_STRESS(base->SetTraceFileName(
|
||||
// GetFilename("VoEStressTest_CreateChannels_trace.txt")));
|
||||
// VALIDATE_STRESS(base->SetDebugTraceFileName(
|
||||
// GetFilename("VoEStressTest_CreateChannels_trace_debug.txt")));
|
||||
// VALIDATE_STRESS(base->SetTraceFilter(kTraceStateInfo |
|
||||
// kTraceWarning | kTraceError |
|
||||
// kTraceCritical | kTraceApiCall |
|
||||
// kTraceMemory | kTraceInfo));
|
||||
///////////// Start test /////////////
|
||||
|
||||
VALIDATE_STRESS(base->Init());
|
||||
int numberOfLoops(10000);
|
||||
int loopSleep(10);
|
||||
int i(0);
|
||||
int markInterval(200);
|
||||
|
||||
///////////// Start test /////////////
|
||||
printf("Running %d loops with %d ms sleep. Mark every %d loop. \n",
|
||||
numberOfLoops, loopSleep, markInterval);
|
||||
printf("Test will take approximately %d minutes. \n",
|
||||
numberOfLoops * loopSleep / 1000 / 60 + 1);
|
||||
|
||||
int numberOfLoops(10000);
|
||||
int loopSleep(10);
|
||||
int i(0);
|
||||
int markInterval(200);
|
||||
// Some possible extensions include:
|
||||
// Different sleep times (fixed or random) or zero.
|
||||
// Start call on all or some channels.
|
||||
// Two parts: first have a slight overweight to creating channels,
|
||||
// then to deleting. (To ensure we hit max channels and go to zero.)
|
||||
// Make sure audio is OK after test has finished.
|
||||
|
||||
printf("Running %d loops with %d ms sleep. Mark every %d loop. \n",
|
||||
numberOfLoops, loopSleep, markInterval);
|
||||
printf("Test will take approximately %d minutes. \n",
|
||||
numberOfLoops * loopSleep / 1000 / 60 + 1);
|
||||
// Set up, start with maxChannels/2 channels
|
||||
const int maxChannels = base->MaxNumOfChannels();
|
||||
VALIDATE_STRESS(maxChannels < 1); // Should always have at least one channel
|
||||
bool* channelState = new bool[maxChannels];
|
||||
memset(channelState, 0, maxChannels * sizeof(bool));
|
||||
int channel(0);
|
||||
int noOfActiveChannels(0);
|
||||
for (i = 0; i < (maxChannels / 2); ++i) {
|
||||
channel = base->CreateChannel();
|
||||
VALIDATE_STRESS(channel < 0);
|
||||
if (channel >= 0) {
|
||||
channelState[channel] = true;
|
||||
++noOfActiveChannels;
|
||||
}
|
||||
}
|
||||
srand((unsigned int) time(NULL));
|
||||
bool action(false);
|
||||
double rnd(0.0);
|
||||
int res(0);
|
||||
|
||||
// Some possible extensions include:
|
||||
// Different sleep times (fixed or random) or zero.
|
||||
// Start call on all or some channels.
|
||||
// Two parts: first have a slight overweight to creating channels,
|
||||
// then to deleting. (To ensure we hit max channels and go to zero.)
|
||||
// Make sure audio is OK after test has finished.
|
||||
|
||||
// Set up, start with maxChannels/2 channels
|
||||
const int maxChannels = base->MaxNumOfChannels();
|
||||
VALIDATE_STRESS(maxChannels < 1); // Should always have at least one channel
|
||||
bool* channelState = new bool[maxChannels];
|
||||
memset(channelState, 0, maxChannels*sizeof(bool));
|
||||
int channel(0);
|
||||
int noOfActiveChannels(0);
|
||||
for (i=0; i<(maxChannels/2); ++i)
|
||||
{
|
||||
// Create/delete channels with slight
|
||||
for (i = 0; i < numberOfLoops; ++i) {
|
||||
// Randomize action (create or delete channel)
|
||||
action = rand() <= (RAND_MAX / 2);
|
||||
if (action) {
|
||||
if (noOfActiveChannels < maxChannels) {
|
||||
// Create new channel
|
||||
channel = base->CreateChannel();
|
||||
VALIDATE_STRESS(channel < 0);
|
||||
if (channel >= 0)
|
||||
{
|
||||
channelState[channel] = true;
|
||||
++noOfActiveChannels;
|
||||
if (channel >= 0) {
|
||||
channelState[channel] = true;
|
||||
++noOfActiveChannels;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (noOfActiveChannels > 0) {
|
||||
// Delete random channel that's created [0, maxChannels - 1]
|
||||
do {
|
||||
rnd = static_cast<double> (rand());
|
||||
channel = static_cast<int> (rnd /
|
||||
(static_cast<double> (RAND_MAX) + 1.0f) *
|
||||
maxChannels);
|
||||
} while (!channelState[channel]); // Must find a created channel
|
||||
|
||||
res = base->DeleteChannel(channel);
|
||||
VALIDATE_STRESS(0 != res);
|
||||
if (0 == res) {
|
||||
channelState[channel] = false;
|
||||
--noOfActiveChannels;
|
||||
}
|
||||
}
|
||||
}
|
||||
srand((unsigned int)time(NULL));
|
||||
bool action(false);
|
||||
double rnd(0.0);
|
||||
int res(0);
|
||||
|
||||
// Create/delete channels with slight
|
||||
for (i=0; i<numberOfLoops; ++i)
|
||||
{
|
||||
// Randomize action (create or delete channel)
|
||||
action = rand() <= (RAND_MAX / 2);
|
||||
if (action)
|
||||
{
|
||||
if (noOfActiveChannels < maxChannels)
|
||||
{
|
||||
// Create new channel
|
||||
channel = base->CreateChannel();
|
||||
VALIDATE_STRESS(channel < 0);
|
||||
if (channel >= 0)
|
||||
{
|
||||
channelState[channel] = true;
|
||||
++noOfActiveChannels;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (noOfActiveChannels > 0)
|
||||
{
|
||||
// Delete random channel that's created [0, maxChannels - 1]
|
||||
do
|
||||
{
|
||||
rnd = static_cast<double>(rand());
|
||||
channel = static_cast<int>(rnd /
|
||||
(static_cast<double>(RAND_MAX) + 1.0f) * maxChannels);
|
||||
} while (!channelState[channel]); // Must find a created channel
|
||||
if (!(i % markInterval))
|
||||
MARK();
|
||||
SLEEP(loopSleep);
|
||||
}
|
||||
ANL();
|
||||
|
||||
res = base->DeleteChannel(channel);
|
||||
VALIDATE_STRESS(0 != res);
|
||||
if (0 == res)
|
||||
{
|
||||
channelState[channel] = false;
|
||||
--noOfActiveChannels;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete[] channelState;
|
||||
|
||||
if (!(i % markInterval)) MARK();
|
||||
SLEEP(loopSleep);
|
||||
}
|
||||
ANL();
|
||||
|
||||
delete [] channelState;
|
||||
|
||||
///////////// End test /////////////
|
||||
///////////// End test /////////////
|
||||
|
||||
|
||||
// Terminate
|
||||
VALIDATE_STRESS(base->Terminate()); // Deletes all channels
|
||||
// Terminate
|
||||
VALIDATE_STRESS(base->Terminate()); // Deletes all channels
|
||||
|
||||
printf("Test finished \n");
|
||||
printf("Test finished \n");
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int VoEStressTest::MultipleThreadsTest() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Running multiple threads test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
|
||||
int VoEStressTest::MultipleThreadsTest()
|
||||
{
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Running multiple threads test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
// Get sub-API pointers
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
|
||||
// Get sub-API pointers
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
// Set trace
|
||||
// VALIDATE_STRESS(base->SetTraceFileName(
|
||||
// GetFilename("VoEStressTest_MultipleThreads_trace.txt")));
|
||||
// VALIDATE_STRESS(base->SetDebugTraceFileName(
|
||||
// GetFilename("VoEStressTest_MultipleThreads_trace_debug.txt")));
|
||||
// VALIDATE_STRESS(base->SetTraceFilter(kTraceStateInfo |
|
||||
// kTraceWarning | kTraceError |
|
||||
// kTraceCritical | kTraceApiCall |
|
||||
// kTraceMemory | kTraceInfo));
|
||||
|
||||
// Set trace
|
||||
// VALIDATE_STRESS(base->SetTraceFileName(
|
||||
// GetFilename("VoEStressTest_MultipleThreads_trace.txt")));
|
||||
// VALIDATE_STRESS(base->SetDebugTraceFileName(
|
||||
// GetFilename("VoEStressTest_MultipleThreads_trace_debug.txt")));
|
||||
// VALIDATE_STRESS(base->SetTraceFilter(kTraceStateInfo |
|
||||
// kTraceWarning | kTraceError |
|
||||
// kTraceCritical | kTraceApiCall |
|
||||
// kTraceMemory | kTraceInfo));
|
||||
// Init
|
||||
VALIDATE_STRESS(base->Init());
|
||||
VALIDATE_STRESS(base->CreateChannel());
|
||||
|
||||
// Init
|
||||
VALIDATE_STRESS(base->Init());
|
||||
VALIDATE_STRESS(base->CreateChannel());
|
||||
///////////// Start test /////////////
|
||||
|
||||
int numberOfLoops(10000);
|
||||
int loopSleep(0);
|
||||
int i(0);
|
||||
int markInterval(1000);
|
||||
|
||||
///////////// Start test /////////////
|
||||
printf("Running %d loops with %d ms sleep. Mark every %d loop. \n",
|
||||
numberOfLoops, loopSleep, markInterval);
|
||||
printf("Test will take approximately %d minutes. \n",
|
||||
numberOfLoops * loopSleep / 1000 / 60 + 1);
|
||||
|
||||
int numberOfLoops(10000);
|
||||
int loopSleep(0);
|
||||
int i(0);
|
||||
int markInterval(1000);
|
||||
srand((unsigned int) time(NULL));
|
||||
int rnd(0);
|
||||
|
||||
printf("Running %d loops with %d ms sleep. Mark every %d loop. \n",
|
||||
numberOfLoops, loopSleep, markInterval);
|
||||
printf("Test will take approximately %d minutes. \n",
|
||||
numberOfLoops * loopSleep / 1000 / 60 + 1);
|
||||
// Start extra thread
|
||||
const char* threadName = "StressTest Extra API Thread";
|
||||
_ptrExtraApiThread = ThreadWrapper::CreateThread(RunExtraApi, this,
|
||||
kNormalPriority, threadName);
|
||||
unsigned int id(0);
|
||||
VALIDATE_STRESS(!_ptrExtraApiThread->Start(id));
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
int rnd(0);
|
||||
// Some possible extensions include:
|
||||
// Add more API calls to randomize
|
||||
// More threads
|
||||
// Different sleep times (fixed or random).
|
||||
// Make sure audio is OK after test has finished.
|
||||
|
||||
// Start extra thread
|
||||
const char* threadName = "StressTest Extra API Thread";
|
||||
_ptrExtraApiThread = ThreadWrapper::CreateThread(
|
||||
RunExtraApi, this, kNormalPriority, threadName);
|
||||
unsigned int id(0);
|
||||
VALIDATE_STRESS(!_ptrExtraApiThread->Start(id));
|
||||
|
||||
// Some possible extensions include:
|
||||
// Add more API calls to randomize
|
||||
// More threads
|
||||
// Different sleep times (fixed or random).
|
||||
// Make sure audio is OK after test has finished.
|
||||
|
||||
// Call random API functions here and in extra thread, ignore any error
|
||||
for (i=0; i<numberOfLoops; ++i)
|
||||
{
|
||||
// This part should be equal to the marked part in the extra thread
|
||||
// --- BEGIN ---
|
||||
rnd = rand();
|
||||
if (rnd < (RAND_MAX / 2))
|
||||
{
|
||||
// Start playout
|
||||
base->StartPlayout(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Stop playout
|
||||
base->StopPlayout(0);
|
||||
}
|
||||
// --- END ---
|
||||
|
||||
if (!(i % markInterval)) MARK();
|
||||
SLEEP(loopSleep);
|
||||
}
|
||||
ANL();
|
||||
|
||||
// Stop extra thread
|
||||
VALIDATE_STRESS(!_ptrExtraApiThread->Stop());
|
||||
delete _ptrExtraApiThread;
|
||||
|
||||
///////////// End test /////////////
|
||||
|
||||
// Terminate
|
||||
VALIDATE_STRESS(base->Terminate()); // Deletes all channels
|
||||
|
||||
printf("Test finished \n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Thread functions
|
||||
|
||||
bool VoEStressTest::RunExtraApi(void* ptr)
|
||||
{
|
||||
return static_cast<VoEStressTest*>(ptr)->ProcessExtraApi();
|
||||
}
|
||||
|
||||
bool VoEStressTest::ProcessExtraApi()
|
||||
{
|
||||
// Prepare
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
int rnd(0);
|
||||
|
||||
// Call random API function, ignore any error
|
||||
|
||||
// This part should be equal to the marked part in the main thread
|
||||
// Call random API functions here and in extra thread, ignore any error
|
||||
for (i = 0; i < numberOfLoops; ++i) {
|
||||
// This part should be equal to the marked part in the extra thread
|
||||
// --- BEGIN ---
|
||||
rnd = rand();
|
||||
if (rnd < (RAND_MAX / 2))
|
||||
{
|
||||
// Start playout
|
||||
base->StartPlayout(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Stop playout
|
||||
base->StopPlayout(0);
|
||||
if (rnd < (RAND_MAX / 2)) {
|
||||
// Start playout
|
||||
base->StartPlayout(0);
|
||||
} else {
|
||||
// Stop playout
|
||||
base->StopPlayout(0);
|
||||
}
|
||||
// --- END ---
|
||||
|
||||
return true;
|
||||
if (!(i % markInterval))
|
||||
MARK();
|
||||
SLEEP(loopSleep);
|
||||
}
|
||||
ANL();
|
||||
|
||||
// Stop extra thread
|
||||
VALIDATE_STRESS(!_ptrExtraApiThread->Stop());
|
||||
delete _ptrExtraApiThread;
|
||||
|
||||
///////////// End test /////////////
|
||||
|
||||
// Terminate
|
||||
VALIDATE_STRESS(base->Terminate()); // Deletes all channels
|
||||
|
||||
printf("Test finished \n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace voetest
|
||||
// Thread functions
|
||||
|
||||
bool VoEStressTest::RunExtraApi(void* ptr) {
|
||||
return static_cast<VoEStressTest*> (ptr)->ProcessExtraApi();
|
||||
}
|
||||
|
||||
bool VoEStressTest::ProcessExtraApi() {
|
||||
// Prepare
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
int rnd(0);
|
||||
|
||||
// Call random API function, ignore any error
|
||||
|
||||
// This part should be equal to the marked part in the main thread
|
||||
// --- BEGIN ---
|
||||
rnd = rand();
|
||||
if (rnd < (RAND_MAX / 2)) {
|
||||
// Start playout
|
||||
base->StartPlayout(0);
|
||||
} else {
|
||||
// Stop playout
|
||||
base->StopPlayout(0);
|
||||
}
|
||||
// --- END ---
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace voetest
|
||||
|
@ -21,28 +21,30 @@ using namespace webrtc;
|
||||
|
||||
class VoETestManager;
|
||||
|
||||
class VoEStressTest
|
||||
{
|
||||
public:
|
||||
VoEStressTest(VoETestManager& mgr) : _mgr(mgr), _ptrExtraApiThread(NULL) {};
|
||||
~VoEStressTest() {};
|
||||
int DoTest();
|
||||
class VoEStressTest {
|
||||
public:
|
||||
VoEStressTest(VoETestManager& mgr) :
|
||||
_mgr(mgr), _ptrExtraApiThread(NULL) {
|
||||
}
|
||||
~VoEStressTest() {
|
||||
}
|
||||
int DoTest();
|
||||
|
||||
private:
|
||||
int MenuSelection();
|
||||
int StartStopTest();
|
||||
int CreateDeleteChannelsTest();
|
||||
int MultipleThreadsTest();
|
||||
private:
|
||||
int MenuSelection();
|
||||
int StartStopTest();
|
||||
int CreateDeleteChannelsTest();
|
||||
int MultipleThreadsTest();
|
||||
|
||||
static bool RunExtraApi(void* ptr);
|
||||
bool ProcessExtraApi();
|
||||
static bool RunExtraApi(void* ptr);
|
||||
bool ProcessExtraApi();
|
||||
|
||||
VoETestManager& _mgr;
|
||||
static const char* _key;
|
||||
VoETestManager& _mgr;
|
||||
static const char* _key;
|
||||
|
||||
ThreadWrapper* _ptrExtraApiThread;
|
||||
ThreadWrapper* _ptrExtraApiThread;
|
||||
};
|
||||
|
||||
} // namespace voetest
|
||||
} // namespace voetest
|
||||
|
||||
#endif // WEBRTC_VOICE_ENGINE_VOE_STRESS_TEST_H
|
||||
|
@ -15,15 +15,15 @@
|
||||
#include "engine_configurations.h"
|
||||
|
||||
#ifdef WEBRTC_ANDROID
|
||||
#include <android/log.h>
|
||||
#define ANDROID_LOG_TAG "VoiceEngine Auto Test"
|
||||
#define TEST_LOG(...) \
|
||||
#include <android/log.h>
|
||||
#define ANDROID_LOG_TAG "VoiceEngine Auto Test"
|
||||
#define TEST_LOG(...) \
|
||||
__android_log_print(ANDROID_LOG_DEBUG, ANDROID_LOG_TAG, __VA_ARGS__)
|
||||
#define TEST_LOG_ERROR(...) \
|
||||
#define TEST_LOG_ERROR(...) \
|
||||
__android_log_print(ANDROID_LOG_ERROR, ANDROID_LOG_TAG, __VA_ARGS__)
|
||||
#else
|
||||
#define TEST_LOG printf
|
||||
#define TEST_LOG_ERROR printf
|
||||
#define TEST_LOG printf
|
||||
#define TEST_LOG_ERROR printf
|
||||
#endif
|
||||
|
||||
// Select the tests to execute, list order below is same as they will be
|
||||
@ -110,16 +110,15 @@
|
||||
#define MARK() TEST_LOG("."); fflush(NULL); // Add test marker
|
||||
#define ANL() TEST_LOG("\n") // Add New Line
|
||||
#define AOK() TEST_LOG("[Test is OK]"); fflush(NULL); // Add OK
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define PAUSE \
|
||||
#define PAUSE \
|
||||
{ \
|
||||
TEST_LOG("Press any key to continue..."); \
|
||||
_getch(); \
|
||||
TEST_LOG("\n"); \
|
||||
}
|
||||
#else
|
||||
#define PAUSE \
|
||||
#define PAUSE \
|
||||
{ \
|
||||
TEST_LOG("Continuing (pause not supported)\n"); \
|
||||
}
|
||||
@ -146,9 +145,9 @@
|
||||
if (err != code) \
|
||||
{ \
|
||||
TEST_LOG_ERROR("Invalid error code (%d, should be %d) at line %d\n",
|
||||
code, err, __LINE__); \
|
||||
} \
|
||||
}
|
||||
code, err, __LINE__);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define ASSERT_TRUE(expr) TEST_MUSTPASS(!(expr))
|
||||
#define ASSERT_FALSE(expr) TEST_MUSTPASS(expr)
|
||||
@ -174,7 +173,6 @@
|
||||
} \
|
||||
}
|
||||
#endif // #ifdef _INSTRUMENTATION_TESTING_
|
||||
|
||||
#define EXCLUDE() \
|
||||
{ \
|
||||
TEST_LOG("\n>>> Excluding test at line: %i <<<\n\n",__LINE__); \
|
||||
|
@ -29,69 +29,61 @@ namespace voetest {
|
||||
using namespace webrtc;
|
||||
|
||||
// TestType enumerator
|
||||
enum TestType
|
||||
{
|
||||
Invalid = -1,
|
||||
Standard = 0,
|
||||
Extended = 1,
|
||||
Stress = 2,
|
||||
Unit = 3,
|
||||
CPU = 4
|
||||
enum TestType {
|
||||
Invalid = -1, Standard = 0, Extended = 1, Stress = 2, Unit = 3, CPU = 4
|
||||
};
|
||||
|
||||
// ExtendedSelection enumerator
|
||||
enum ExtendedSelection
|
||||
{
|
||||
XSEL_Invalid = -1,
|
||||
XSEL_None = 0,
|
||||
XSEL_All,
|
||||
XSEL_Base,
|
||||
XSEL_CallReport,
|
||||
XSEL_Codec,
|
||||
XSEL_DTMF,
|
||||
XSEL_Encryption,
|
||||
XSEL_ExternalMedia,
|
||||
XSEL_File,
|
||||
XSEL_Mixing,
|
||||
XSEL_Hardware,
|
||||
XSEL_NetEqStats,
|
||||
XSEL_Network,
|
||||
XSEL_RTP_RTCP,
|
||||
XSEL_VideoSync,
|
||||
XSEL_VolumeControl,
|
||||
XSEL_AudioProcessing,
|
||||
enum ExtendedSelection {
|
||||
XSEL_Invalid = -1,
|
||||
XSEL_None = 0,
|
||||
XSEL_All,
|
||||
XSEL_Base,
|
||||
XSEL_CallReport,
|
||||
XSEL_Codec,
|
||||
XSEL_DTMF,
|
||||
XSEL_Encryption,
|
||||
XSEL_ExternalMedia,
|
||||
XSEL_File,
|
||||
XSEL_Mixing,
|
||||
XSEL_Hardware,
|
||||
XSEL_NetEqStats,
|
||||
XSEL_Network,
|
||||
XSEL_RTP_RTCP,
|
||||
XSEL_VideoSync,
|
||||
XSEL_VolumeControl,
|
||||
XSEL_AudioProcessing,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// External transport (Transport)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class my_transportation : public Transport
|
||||
{
|
||||
public:
|
||||
my_transportation(VoENetwork* ptr);
|
||||
virtual ~my_transportation();
|
||||
VoENetwork* myNetw;
|
||||
int SendPacket(int channel,const void *data,int len);
|
||||
int SendRTCPPacket(int channel, const void *data, int len);
|
||||
void SetDelayStatus(bool enabled, unsigned int delayInMs = 100);
|
||||
private:
|
||||
static bool Run(void* ptr);
|
||||
bool Process();
|
||||
private:
|
||||
ThreadWrapper* _thread;
|
||||
CriticalSectionWrapper* _lock;
|
||||
EventWrapper* _event;
|
||||
private:
|
||||
unsigned char _packetBuffer[1612];
|
||||
int _length;
|
||||
int _channel;
|
||||
bool _delayIsEnabled;
|
||||
int _delayTimeInMs;
|
||||
class my_transportation : public Transport {
|
||||
public:
|
||||
my_transportation(VoENetwork* ptr);
|
||||
virtual ~my_transportation();
|
||||
VoENetwork* myNetw;
|
||||
int SendPacket(int channel, const void *data, int len);
|
||||
int SendRTCPPacket(int channel, const void *data, int len);
|
||||
void SetDelayStatus(bool enabled, unsigned int delayInMs = 100);
|
||||
private:
|
||||
static bool Run(void* ptr);
|
||||
bool Process();
|
||||
private:
|
||||
ThreadWrapper* _thread;
|
||||
CriticalSectionWrapper* _lock;
|
||||
EventWrapper* _event;
|
||||
private:
|
||||
unsigned char _packetBuffer[1612];
|
||||
int _length;
|
||||
int _channel;
|
||||
bool _delayIsEnabled;
|
||||
int _delayTimeInMs;
|
||||
};
|
||||
|
||||
// Main test function
|
||||
int runAutoTest(TestType testType, ExtendedSelection extendedSel);
|
||||
|
||||
} // namespace voetest
|
||||
} // namespace voetest
|
||||
#endif // WEBRTC_VOICE_ENGINE_VOE_TEST_INTERFACE_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,51 +17,53 @@ namespace voetest {
|
||||
|
||||
class VoETestManager;
|
||||
|
||||
class VoEUnitTest : public Encryption
|
||||
{
|
||||
public:
|
||||
VoEUnitTest(VoETestManager& mgr);
|
||||
~VoEUnitTest() {};
|
||||
int DoTest();
|
||||
class VoEUnitTest : public Encryption {
|
||||
public:
|
||||
VoEUnitTest(VoETestManager& mgr);
|
||||
~VoEUnitTest() {}
|
||||
int DoTest();
|
||||
|
||||
protected:
|
||||
// Encryption
|
||||
void encrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void decrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void encrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void decrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
protected:
|
||||
// Encryption
|
||||
void encrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void decrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void encrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
void decrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
|
||||
private:
|
||||
int MenuSelection();
|
||||
int MixerTest();
|
||||
void Sleep(unsigned int timeMillisec, bool addMarker = false);
|
||||
void Wait();
|
||||
int StartMedia(int channel, int rtpPort, bool listen, bool playout,
|
||||
bool send, bool fileAsMic, bool localFile);
|
||||
int StopMedia(int channel);
|
||||
void Test(const char* msg);
|
||||
void SetStereoExternalEncryption(int channel,
|
||||
bool onOff,
|
||||
int bitsPerSample);
|
||||
private:
|
||||
int MenuSelection();
|
||||
int MixerTest();
|
||||
void Sleep(unsigned int timeMillisec, bool addMarker = false);
|
||||
void Wait();
|
||||
int StartMedia(int channel,
|
||||
int rtpPort,
|
||||
bool listen,
|
||||
bool playout,
|
||||
bool send,
|
||||
bool fileAsMic,
|
||||
bool localFile);
|
||||
int StopMedia(int channel);
|
||||
void Test(const char* msg);
|
||||
void SetStereoExternalEncryption(int channel, bool onOff, int bitsPerSample);
|
||||
|
||||
private:
|
||||
VoETestManager& _mgr;
|
||||
static const char* _key;
|
||||
private:
|
||||
VoETestManager& _mgr;
|
||||
static const char* _key;
|
||||
|
||||
private:
|
||||
bool _listening[32];
|
||||
bool _playing[32];
|
||||
bool _sending[32];
|
||||
private:
|
||||
bool _listening[32];
|
||||
bool _playing[32];
|
||||
bool _sending[32];
|
||||
|
||||
private:
|
||||
bool _extOnOff;
|
||||
int _extBitsPerSample;
|
||||
int _extChannel;
|
||||
private:
|
||||
bool _extOnOff;
|
||||
int _extBitsPerSample;
|
||||
int _extChannel;
|
||||
};
|
||||
|
||||
} // namespace voetest
|
||||
} // namespace voetest
|
||||
#endif // WEBRTC_VOICE_ENGINE_VOE_UNIT_TEST_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user