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,14 +37,12 @@ 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()
|
||||
{
|
||||
int VoECpuTest::DoTest() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf(" CPU Reference Test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
|
@ -17,13 +17,12 @@ namespace voetest {
|
||||
|
||||
class VoETestManager;
|
||||
|
||||
class VoECpuTest
|
||||
{
|
||||
public:
|
||||
class VoECpuTest {
|
||||
public:
|
||||
VoECpuTest(VoETestManager& mgr);
|
||||
~VoECpuTest() {};
|
||||
~VoECpuTest() {}
|
||||
int DoTest();
|
||||
private:
|
||||
private:
|
||||
VoETestManager& _mgr;
|
||||
};
|
||||
|
||||
|
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,125 +74,247 @@ 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 guid[kAdmMaxGuidSize]) {
|
||||
return -1;
|
||||
}
|
||||
virtual int32_t RecordingDeviceName(uint16_t index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]) { return -1; }
|
||||
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 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 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
@ -192,15 +329,21 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
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,42 +351,44 @@ private:
|
||||
// Transport
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ExtendedTestTransport : public Transport
|
||||
{
|
||||
public:
|
||||
class ExtendedTestTransport : public Transport {
|
||||
public:
|
||||
ExtendedTestTransport(VoENetwork* ptr);
|
||||
~ExtendedTestTransport();
|
||||
VoENetwork* myNetw;
|
||||
protected:
|
||||
virtual int SendPacket(int channel,const void *data,int len);
|
||||
|
||||
protected:
|
||||
virtual int SendPacket(int channel, const void *data, int len);
|
||||
virtual int SendRTCPPacket(int channel, const void *data, int len);
|
||||
private:
|
||||
|
||||
private:
|
||||
static bool Run(void* ptr);
|
||||
bool Process();
|
||||
private:
|
||||
|
||||
private:
|
||||
ThreadWrapper* _thread;
|
||||
CriticalSectionWrapper* _lock;
|
||||
EventWrapper* _event;
|
||||
private:
|
||||
|
||||
private:
|
||||
unsigned char _packetBuffer[1612];
|
||||
int _length;
|
||||
int _channel;
|
||||
};
|
||||
|
||||
class XTransport : public Transport
|
||||
{
|
||||
public:
|
||||
class XTransport : public Transport {
|
||||
public:
|
||||
XTransport(VoENetwork* netw, VoEFile* file);
|
||||
VoENetwork* _netw;
|
||||
VoEFile* _file;
|
||||
public:
|
||||
|
||||
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:
|
||||
class XRTPObserver : public VoERTPObserver {
|
||||
public:
|
||||
XRTPObserver();
|
||||
~XRTPObserver();
|
||||
virtual void OnIncomingCSRCChanged(const int channel,
|
||||
@ -251,7 +396,7 @@ public:
|
||||
const bool added);
|
||||
virtual void OnIncomingSSRCChanged(const int channel,
|
||||
const unsigned int SSRC);
|
||||
public:
|
||||
public:
|
||||
unsigned int _SSRC;
|
||||
};
|
||||
|
||||
@ -260,9 +405,8 @@ public:
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class VoEExtendedTest : public VoiceEngineObserver,
|
||||
public VoEConnectionObserver
|
||||
{
|
||||
public:
|
||||
public VoEConnectionObserver {
|
||||
public:
|
||||
VoEExtendedTest(VoETestManager& mgr);
|
||||
~VoEExtendedTest();
|
||||
int PrepareTest(const char* str) const;
|
||||
@ -282,45 +426,31 @@ public:
|
||||
int TestVideoSync();
|
||||
int TestVolumeControl();
|
||||
int TestAPM();
|
||||
public:
|
||||
int ErrorCode() const
|
||||
{
|
||||
public:
|
||||
int ErrorCode() const {
|
||||
return _errCode;
|
||||
}
|
||||
;
|
||||
void ClearErrorCode()
|
||||
{
|
||||
void ClearErrorCode() {
|
||||
_errCode = 0;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
protected:
|
||||
// from VoiceEngineObserver
|
||||
void CallbackOnError(const int errCode, const int channel);
|
||||
void CallbackOnTrace(const TraceLevel level,
|
||||
const char* message,
|
||||
const int length);
|
||||
protected:
|
||||
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,
|
||||
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 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,
|
||||
int RunMixingTest(int num_channels, int16_t input_value, int16_t max_output_value,
|
||||
int16_t min_output_value);
|
||||
private:
|
||||
private:
|
||||
VoETestManager& _mgr;
|
||||
private:
|
||||
private:
|
||||
int _errCode;
|
||||
bool _alive;
|
||||
bool _listening[32];
|
||||
|
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,15 +60,13 @@ class VoENetEqStats;
|
||||
extern char mobileLogMsg[640];
|
||||
#endif
|
||||
|
||||
namespace voetest
|
||||
{
|
||||
namespace voetest {
|
||||
|
||||
void createSummary(VoiceEngine* ve);
|
||||
void prepareDelivery();
|
||||
|
||||
class MyRTPObserver: public VoERTPObserver
|
||||
{
|
||||
public:
|
||||
class MyRTPObserver : public VoERTPObserver {
|
||||
public:
|
||||
MyRTPObserver();
|
||||
~MyRTPObserver();
|
||||
virtual void OnIncomingCSRCChanged(const int channel,
|
||||
@ -78,65 +75,55 @@ public:
|
||||
virtual void OnIncomingSSRCChanged(const int channel,
|
||||
const unsigned int SSRC);
|
||||
void Reset();
|
||||
public:
|
||||
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:
|
||||
class MyDeadOrAlive : public VoEConnectionObserver {
|
||||
public:
|
||||
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
||||
};
|
||||
|
||||
class ErrorObserver: public VoiceEngineObserver
|
||||
{
|
||||
public:
|
||||
class ErrorObserver : public VoiceEngineObserver {
|
||||
public:
|
||||
ErrorObserver();
|
||||
void CallbackOnError(const int channel, const int errCode);
|
||||
public:
|
||||
public:
|
||||
int code;
|
||||
};
|
||||
|
||||
class RtcpAppHandler: public VoERTCPObserver
|
||||
{
|
||||
public:
|
||||
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()
|
||||
{
|
||||
};
|
||||
~RtcpAppHandler() {}
|
||||
unsigned short _lengthBytes;
|
||||
unsigned char _data[256];
|
||||
unsigned char _subType;
|
||||
unsigned int _name;
|
||||
};
|
||||
|
||||
class DtmfCallback: public VoETelephoneEventObserver
|
||||
{
|
||||
public:
|
||||
class DtmfCallback : public VoETelephoneEventObserver {
|
||||
public:
|
||||
int counter;
|
||||
DtmfCallback()
|
||||
{
|
||||
DtmfCallback() {
|
||||
counter = 0;
|
||||
}
|
||||
virtual void OnReceivedTelephoneEventInband(int channel,
|
||||
int eventCode,
|
||||
bool endOfEvent)
|
||||
{
|
||||
bool endOfEvent) {
|
||||
char msg[128];
|
||||
if (endOfEvent)
|
||||
sprintf(msg, "(event=%d, [END])", eventCode);
|
||||
@ -148,11 +135,9 @@ public:
|
||||
fflush(NULL);
|
||||
}
|
||||
|
||||
virtual void OnReceivedTelephoneEventOutOfBand(
|
||||
int channel,
|
||||
virtual void OnReceivedTelephoneEventOutOfBand(int channel,
|
||||
int eventCode,
|
||||
bool endOfEvent)
|
||||
{
|
||||
bool endOfEvent) {
|
||||
char msg[128];
|
||||
if (endOfEvent)
|
||||
sprintf(msg, "(event=%d, [END])", eventCode);
|
||||
@ -165,8 +150,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class my_encryption: public Encryption
|
||||
{
|
||||
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,
|
||||
@ -177,16 +161,13 @@ class my_encryption: public Encryption
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
};
|
||||
|
||||
class RxCallback: public VoERxVadCallback
|
||||
{
|
||||
public:
|
||||
class RxCallback : public VoERxVadCallback {
|
||||
public:
|
||||
RxCallback() :
|
||||
_vadDecision(-1)
|
||||
{
|
||||
};
|
||||
_vadDecision(-1) {
|
||||
}
|
||||
|
||||
virtual void OnRxVad(int, int vadDecision)
|
||||
{
|
||||
virtual void OnRxVad(int, int vadDecision) {
|
||||
char msg[128];
|
||||
sprintf(msg, "RX VAD detected decision %d \n", vadDecision);
|
||||
TEST_LOG("%s", msg);
|
||||
@ -197,22 +178,23 @@ public:
|
||||
};
|
||||
|
||||
#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:
|
||||
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),
|
||||
class SubAPIManager {
|
||||
public:
|
||||
SubAPIManager()
|
||||
: _base(true),
|
||||
_callReport(false),
|
||||
_codec(false),
|
||||
_dtmf(false),
|
||||
@ -226,8 +208,7 @@ public:
|
||||
_videoSync(false),
|
||||
_volumeControl(false),
|
||||
_apm(false),
|
||||
_xsel(XSEL_Invalid)
|
||||
{
|
||||
_xsel(XSEL_Invalid) {
|
||||
#ifdef WEBRTC_VOICE_ENGINE_CALL_REPORT_API
|
||||
_callReport = true;
|
||||
#endif
|
||||
@ -267,21 +248,20 @@ public:
|
||||
#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
|
||||
_apm = true;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
void DisplayStatus() const;
|
||||
bool GetExtendedMenuSelection(ExtendedSelection& sel);
|
||||
|
||||
private:
|
||||
private:
|
||||
bool _base, _callReport, _codec, _dtmf, _encryption;
|
||||
bool _externalMedia, _file, _hardware;
|
||||
bool _netEqStats, _network, _rtp_rtcp, _videoSync, _volumeControl, _apm;
|
||||
ExtendedSelection _xsel;
|
||||
};
|
||||
|
||||
class VoETestManager
|
||||
{
|
||||
public:
|
||||
class VoETestManager {
|
||||
public:
|
||||
VoETestManager();
|
||||
~VoETestManager();
|
||||
|
||||
@ -292,75 +272,68 @@ public:
|
||||
int ReleaseInterfaces();
|
||||
int DoStandardTest();
|
||||
|
||||
const char* AudioFilename() const
|
||||
{
|
||||
const char* AudioFilename() const {
|
||||
return audioFilename_.c_str();
|
||||
}
|
||||
|
||||
VoiceEngine* VoiceEnginePtr() const
|
||||
{
|
||||
VoiceEngine* VoiceEnginePtr() const {
|
||||
return ve;
|
||||
};
|
||||
VoEBase* BasePtr() const
|
||||
{
|
||||
}
|
||||
VoEBase* BasePtr() const {
|
||||
return base;
|
||||
};
|
||||
VoECodec* CodecPtr() const
|
||||
{
|
||||
}
|
||||
VoECodec* CodecPtr() const {
|
||||
return codec;
|
||||
};
|
||||
VoEVolumeControl* VolumeControlPtr() const
|
||||
{
|
||||
}
|
||||
VoEVolumeControl* VolumeControlPtr() const {
|
||||
return volume;
|
||||
};
|
||||
VoEDtmf* DtmfPtr() const
|
||||
{
|
||||
}
|
||||
VoEDtmf* DtmfPtr() const {
|
||||
return dtmf;
|
||||
};
|
||||
VoERTP_RTCP* RTP_RTCPPtr() const
|
||||
{
|
||||
}
|
||||
VoERTP_RTCP* RTP_RTCPPtr() const {
|
||||
return rtp_rtcp;
|
||||
};
|
||||
VoEAudioProcessing* APMPtr() const
|
||||
{
|
||||
}
|
||||
VoEAudioProcessing* APMPtr() const {
|
||||
return apm;
|
||||
};
|
||||
VoENetwork* NetworkPtr() const
|
||||
{
|
||||
}
|
||||
|
||||
VoENetwork* NetworkPtr() const {
|
||||
return netw;
|
||||
};
|
||||
VoEFile* FilePtr() const
|
||||
{
|
||||
}
|
||||
|
||||
VoEFile* FilePtr() const {
|
||||
return file;
|
||||
};
|
||||
VoEHardware* HardwarePtr() const
|
||||
{
|
||||
}
|
||||
|
||||
VoEHardware* HardwarePtr() const {
|
||||
return hardware;
|
||||
};
|
||||
VoEVideoSync* VideoSyncPtr() const
|
||||
{
|
||||
}
|
||||
|
||||
VoEVideoSync* VideoSyncPtr() const {
|
||||
return vsync;
|
||||
};
|
||||
VoEEncryption* EncryptionPtr() const
|
||||
{
|
||||
}
|
||||
|
||||
VoEEncryption* EncryptionPtr() const {
|
||||
return encrypt;
|
||||
};
|
||||
VoEExternalMedia* ExternalMediaPtr() const
|
||||
{
|
||||
}
|
||||
|
||||
VoEExternalMedia* ExternalMediaPtr() const {
|
||||
return xmedia;
|
||||
};
|
||||
VoECallReport* CallReportPtr() const
|
||||
{
|
||||
}
|
||||
|
||||
VoECallReport* CallReportPtr() const {
|
||||
return report;
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef _TEST_NETEQ_STATS_
|
||||
VoENetEqStats* NetEqStatsPtr() const
|
||||
{
|
||||
VoENetEqStats* NetEqStatsPtr() const {
|
||||
return neteqst;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
private:
|
||||
bool initialized_;
|
||||
VoiceEngine* ve;
|
||||
VoEBase* base;
|
||||
|
@ -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,7 +53,6 @@ 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"
|
||||
@ -62,15 +60,11 @@ const char* VoEStressTest::_key = "====YUtFWRAAAAADBtIHgAAAAAEAAAAcAAAAAQBHU0ds"
|
||||
"\nOrs3sIuwdYK5va/aFcsjBDmlsGCUM48RDYG9s23bIHYafXUC4ofOaubbZPWiPTmL\nEVJ8WH"
|
||||
"4F9pgNjALc14oJXfON7r/3\n=EsLx";
|
||||
|
||||
|
||||
int VoEStressTest::DoTest()
|
||||
{
|
||||
int VoEStressTest::DoTest() {
|
||||
int test(-1);
|
||||
while (test != 0)
|
||||
{
|
||||
while (test != 0) {
|
||||
test = MenuSelection();
|
||||
switch (test)
|
||||
{
|
||||
switch (test) {
|
||||
case 0:
|
||||
// Quit stress test
|
||||
break;
|
||||
@ -99,9 +93,7 @@ int VoEStressTest::DoTest()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int VoEStressTest::MenuSelection()
|
||||
{
|
||||
int VoEStressTest::MenuSelection() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Select stress test\n\n");
|
||||
printf(" (0) Quit\n");
|
||||
@ -114,12 +106,10 @@ int VoEStressTest::MenuSelection()
|
||||
const int maxMenuSelection = 4;
|
||||
int selection(-1);
|
||||
|
||||
while ((selection < 0) || (selection > maxMenuSelection))
|
||||
{
|
||||
while ((selection < 0) || (selection > maxMenuSelection)) {
|
||||
printf("\n: ");
|
||||
int retval = scanf("%d", &selection);
|
||||
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection))
|
||||
{
|
||||
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection)) {
|
||||
printf("Invalid selection!\n");
|
||||
}
|
||||
}
|
||||
@ -127,9 +117,7 @@ int VoEStressTest::MenuSelection()
|
||||
return selection;
|
||||
}
|
||||
|
||||
|
||||
int VoEStressTest::StartStopTest()
|
||||
{
|
||||
int VoEStressTest::StartStopTest() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Running start/stop test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
@ -141,19 +129,17 @@ int VoEStressTest::StartStopTest()
|
||||
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->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());
|
||||
|
||||
|
||||
///////////// Start test /////////////
|
||||
|
||||
int numberOfLoops(2000);
|
||||
@ -164,16 +150,16 @@ int VoEStressTest::StartStopTest()
|
||||
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);
|
||||
numberOfLoops * loopSleep / 1000 / 60 + 1);
|
||||
|
||||
for (i=0; i<numberOfLoops; ++i)
|
||||
{
|
||||
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();
|
||||
if (!(i % markInterval))
|
||||
MARK();
|
||||
SLEEP(loopSleep);
|
||||
VALIDATE_STRESS(base->StopSend(0));
|
||||
VALIDATE_STRESS(base->StopPlayout(0));
|
||||
@ -204,9 +190,7 @@ int VoEStressTest::StartStopTest()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int VoEStressTest::CreateDeleteChannelsTest()
|
||||
{
|
||||
int VoEStressTest::CreateDeleteChannelsTest() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Running create/delete channels test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
@ -215,15 +199,14 @@ int VoEStressTest::CreateDeleteChannelsTest()
|
||||
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->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());
|
||||
|
||||
///////////// Start test /////////////
|
||||
@ -249,71 +232,62 @@ int VoEStressTest::CreateDeleteChannelsTest()
|
||||
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));
|
||||
memset(channelState, 0, maxChannels * sizeof(bool));
|
||||
int channel(0);
|
||||
int noOfActiveChannels(0);
|
||||
for (i=0; i<(maxChannels/2); ++i)
|
||||
{
|
||||
for (i = 0; i < (maxChannels / 2); ++i) {
|
||||
channel = base->CreateChannel();
|
||||
VALIDATE_STRESS(channel < 0);
|
||||
if (channel >= 0)
|
||||
{
|
||||
if (channel >= 0) {
|
||||
channelState[channel] = true;
|
||||
++noOfActiveChannels;
|
||||
}
|
||||
}
|
||||
srand((unsigned int)time(NULL));
|
||||
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)
|
||||
{
|
||||
for (i = 0; i < numberOfLoops; ++i) {
|
||||
// Randomize action (create or delete channel)
|
||||
action = rand() <= (RAND_MAX / 2);
|
||||
if (action)
|
||||
{
|
||||
if (noOfActiveChannels < maxChannels)
|
||||
{
|
||||
if (action) {
|
||||
if (noOfActiveChannels < maxChannels) {
|
||||
// Create new channel
|
||||
channel = base->CreateChannel();
|
||||
VALIDATE_STRESS(channel < 0);
|
||||
if (channel >= 0)
|
||||
{
|
||||
if (channel >= 0) {
|
||||
channelState[channel] = true;
|
||||
++noOfActiveChannels;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (noOfActiveChannels > 0)
|
||||
{
|
||||
} 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);
|
||||
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)
|
||||
{
|
||||
if (0 == res) {
|
||||
channelState[channel] = false;
|
||||
--noOfActiveChannels;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(i % markInterval)) MARK();
|
||||
if (!(i % markInterval))
|
||||
MARK();
|
||||
SLEEP(loopSleep);
|
||||
}
|
||||
ANL();
|
||||
|
||||
delete [] channelState;
|
||||
delete[] channelState;
|
||||
|
||||
///////////// End test /////////////
|
||||
|
||||
@ -326,9 +300,7 @@ int VoEStressTest::CreateDeleteChannelsTest()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int VoEStressTest::MultipleThreadsTest()
|
||||
{
|
||||
int VoEStressTest::MultipleThreadsTest() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Running multiple threads test\n");
|
||||
printf("------------------------------------------------\n");
|
||||
@ -337,20 +309,19 @@ int VoEStressTest::MultipleThreadsTest()
|
||||
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));
|
||||
// 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());
|
||||
|
||||
|
||||
///////////// Start test /////////////
|
||||
|
||||
int numberOfLoops(10000);
|
||||
@ -363,13 +334,13 @@ int VoEStressTest::MultipleThreadsTest()
|
||||
printf("Test will take approximately %d minutes. \n",
|
||||
numberOfLoops * loopSleep / 1000 / 60 + 1);
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
srand((unsigned int) time(NULL));
|
||||
int rnd(0);
|
||||
|
||||
// Start extra thread
|
||||
const char* threadName = "StressTest Extra API Thread";
|
||||
_ptrExtraApiThread = ThreadWrapper::CreateThread(
|
||||
RunExtraApi, this, kNormalPriority, threadName);
|
||||
_ptrExtraApiThread = ThreadWrapper::CreateThread(RunExtraApi, this,
|
||||
kNormalPriority, threadName);
|
||||
unsigned int id(0);
|
||||
VALIDATE_STRESS(!_ptrExtraApiThread->Start(id));
|
||||
|
||||
@ -380,24 +351,21 @@ int VoEStressTest::MultipleThreadsTest()
|
||||
// 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)
|
||||
{
|
||||
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))
|
||||
{
|
||||
if (rnd < (RAND_MAX / 2)) {
|
||||
// Start playout
|
||||
base->StartPlayout(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Stop playout
|
||||
base->StopPlayout(0);
|
||||
}
|
||||
// --- END ---
|
||||
|
||||
if (!(i % markInterval)) MARK();
|
||||
if (!(i % markInterval))
|
||||
MARK();
|
||||
SLEEP(loopSleep);
|
||||
}
|
||||
ANL();
|
||||
@ -416,16 +384,13 @@ int VoEStressTest::MultipleThreadsTest()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Thread functions
|
||||
|
||||
bool VoEStressTest::RunExtraApi(void* ptr)
|
||||
{
|
||||
return static_cast<VoEStressTest*>(ptr)->ProcessExtraApi();
|
||||
bool VoEStressTest::RunExtraApi(void* ptr) {
|
||||
return static_cast<VoEStressTest*> (ptr)->ProcessExtraApi();
|
||||
}
|
||||
|
||||
bool VoEStressTest::ProcessExtraApi()
|
||||
{
|
||||
bool VoEStressTest::ProcessExtraApi() {
|
||||
// Prepare
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
int rnd(0);
|
||||
@ -435,13 +400,10 @@ bool VoEStressTest::ProcessExtraApi()
|
||||
// This part should be equal to the marked part in the main thread
|
||||
// --- BEGIN ---
|
||||
rnd = rand();
|
||||
if (rnd < (RAND_MAX / 2))
|
||||
{
|
||||
if (rnd < (RAND_MAX / 2)) {
|
||||
// Start playout
|
||||
base->StartPlayout(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Stop playout
|
||||
base->StopPlayout(0);
|
||||
}
|
||||
|
@ -21,14 +21,16 @@ using namespace webrtc;
|
||||
|
||||
class VoETestManager;
|
||||
|
||||
class VoEStressTest
|
||||
{
|
||||
public:
|
||||
VoEStressTest(VoETestManager& mgr) : _mgr(mgr), _ptrExtraApiThread(NULL) {};
|
||||
~VoEStressTest() {};
|
||||
class VoEStressTest {
|
||||
public:
|
||||
VoEStressTest(VoETestManager& mgr) :
|
||||
_mgr(mgr), _ptrExtraApiThread(NULL) {
|
||||
}
|
||||
~VoEStressTest() {
|
||||
}
|
||||
int DoTest();
|
||||
|
||||
private:
|
||||
private:
|
||||
int MenuSelection();
|
||||
int StartStopTest();
|
||||
int CreateDeleteChannelsTest();
|
||||
|
@ -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,19 +29,12 @@ 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
|
||||
{
|
||||
enum ExtendedSelection {
|
||||
XSEL_Invalid = -1,
|
||||
XSEL_None = 0,
|
||||
XSEL_All,
|
||||
@ -66,23 +59,22 @@ enum ExtendedSelection
|
||||
// External transport (Transport)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class my_transportation : public Transport
|
||||
{
|
||||
public:
|
||||
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 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:
|
||||
private:
|
||||
static bool Run(void* ptr);
|
||||
bool Process();
|
||||
private:
|
||||
private:
|
||||
ThreadWrapper* _thread;
|
||||
CriticalSectionWrapper* _lock;
|
||||
EventWrapper* _event;
|
||||
private:
|
||||
private:
|
||||
unsigned char _packetBuffer[1612];
|
||||
int _length;
|
||||
int _channel;
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <time.h>
|
||||
#include <cassert>
|
||||
#if defined(_WIN32)
|
||||
#include <conio.h>
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
#include "voe_unit_test.h"
|
||||
@ -57,7 +57,7 @@ const char* VoEUnitTest::_key = "====YUtFWRAAAAADBtIHgAAAAAEAAAAcAAAAAQBHU0dsb2"
|
||||
// - G.729
|
||||
// - G.722.1C
|
||||
|
||||
// 2) It is also possible to modify the simulation time for each indivifual test
|
||||
// 2) It is also possible to modify the simulation time for each individual test
|
||||
//
|
||||
const int dTBetweenEachTest = 4000;
|
||||
|
||||
@ -65,26 +65,20 @@ const int dTBetweenEachTest = 4000;
|
||||
// Encrypt
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void VoEUnitTest::encrypt(int channel_no,
|
||||
unsigned char * in_data,
|
||||
unsigned char * out_data,
|
||||
int bytes_in,
|
||||
int * bytes_out)
|
||||
{
|
||||
void VoEUnitTest::encrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in,
|
||||
int * bytes_out) {
|
||||
int i;
|
||||
|
||||
if (!_extOnOff)
|
||||
{
|
||||
if (!_extOnOff) {
|
||||
// no stereo emulation <=> pure bypass
|
||||
for (i = 0; i < bytes_in; i++)
|
||||
out_data[i] = in_data[i];
|
||||
*bytes_out = bytes_in;
|
||||
}
|
||||
else if (_extOnOff && (_extBitsPerSample == 16))
|
||||
{
|
||||
} else if (_extOnOff && (_extBitsPerSample == 16)) {
|
||||
// stereo emulation (sample based, 2 bytes per sample)
|
||||
|
||||
const int nBytesPayload = bytes_in-12;
|
||||
const int nBytesPayload = bytes_in - 12;
|
||||
|
||||
// RTP header (first 12 bytes)
|
||||
memcpy(out_data, in_data, 12);
|
||||
@ -94,21 +88,18 @@ void VoEUnitTest::encrypt(int channel_no,
|
||||
short* ptrOut = (short*) &out_data[12];
|
||||
|
||||
// network byte order
|
||||
for (i = 0; i < nBytesPayload/2; i++)
|
||||
{
|
||||
for (i = 0; i < nBytesPayload / 2; i++) {
|
||||
// produce two output samples for each input sample
|
||||
*ptrOut++ = *ptrIn; // left sample
|
||||
*ptrOut++ = *ptrIn; // right sample
|
||||
ptrIn++;
|
||||
}
|
||||
|
||||
*bytes_out = 12 + 2*nBytesPayload;
|
||||
}
|
||||
else if (_extOnOff && (_extBitsPerSample == 8))
|
||||
{
|
||||
*bytes_out = 12 + 2 * nBytesPayload;
|
||||
} else if (_extOnOff && (_extBitsPerSample == 8)) {
|
||||
// stereo emulation (sample based, 1 bytes per sample)
|
||||
|
||||
const int nBytesPayload = bytes_in-12;
|
||||
const int nBytesPayload = bytes_in - 12;
|
||||
|
||||
// RTP header (first 12 bytes)
|
||||
memcpy(out_data, in_data, 12);
|
||||
@ -118,21 +109,18 @@ void VoEUnitTest::encrypt(int channel_no,
|
||||
unsigned char* ptrOut = (unsigned char*) &out_data[12];
|
||||
|
||||
// network byte order
|
||||
for (i = 0; i < nBytesPayload; i++)
|
||||
{
|
||||
for (i = 0; i < nBytesPayload; i++) {
|
||||
// produce two output samples for each input sample
|
||||
*ptrOut++ = *ptrIn; // left sample
|
||||
*ptrOut++ = *ptrIn; // right sample
|
||||
ptrIn++;
|
||||
}
|
||||
|
||||
*bytes_out = 12 + 2*nBytesPayload;
|
||||
}
|
||||
else if (_extOnOff && (_extBitsPerSample == -1))
|
||||
{
|
||||
*bytes_out = 12 + 2 * nBytesPayload;
|
||||
} else if (_extOnOff && (_extBitsPerSample == -1)) {
|
||||
// stereo emulation (frame based)
|
||||
|
||||
const int nBytesPayload = bytes_in-12;
|
||||
const int nBytesPayload = bytes_in - 12;
|
||||
|
||||
// RTP header (first 12 bytes)
|
||||
memcpy(out_data, in_data, 12);
|
||||
@ -142,63 +130,50 @@ void VoEUnitTest::encrypt(int channel_no,
|
||||
unsigned char* ptrOut = (unsigned char*) &out_data[12];
|
||||
|
||||
// left channel
|
||||
for (i = 0; i < nBytesPayload; i++)
|
||||
{
|
||||
for (i = 0; i < nBytesPayload; i++) {
|
||||
*ptrOut++ = *ptrIn++;
|
||||
}
|
||||
|
||||
ptrIn = (unsigned char*) &in_data[12];
|
||||
|
||||
// right channel
|
||||
for (i = 0; i < nBytesPayload; i++)
|
||||
{
|
||||
for (i = 0; i < nBytesPayload; i++) {
|
||||
*ptrOut++ = *ptrIn++;
|
||||
}
|
||||
|
||||
*bytes_out = 12 + 2*nBytesPayload;
|
||||
*bytes_out = 12 + 2 * nBytesPayload;
|
||||
}
|
||||
}
|
||||
|
||||
void VoEUnitTest::decrypt(int channel_no,
|
||||
unsigned char * in_data,
|
||||
unsigned char * out_data,
|
||||
int bytes_in,
|
||||
int * bytes_out)
|
||||
{
|
||||
void VoEUnitTest::decrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in,
|
||||
int * bytes_out) {
|
||||
int i;
|
||||
for (i = 0; i < bytes_in; i++)
|
||||
out_data[i] = in_data[i];
|
||||
*bytes_out = bytes_in;
|
||||
}
|
||||
|
||||
void VoEUnitTest::encrypt_rtcp(int channel_no,
|
||||
unsigned char * in_data,
|
||||
unsigned char * out_data,
|
||||
int bytes_in,
|
||||
int * bytes_out)
|
||||
{
|
||||
void VoEUnitTest::encrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in,
|
||||
int * bytes_out) {
|
||||
int i;
|
||||
for (i = 0; i < bytes_in; i++)
|
||||
out_data[i] = in_data[i];
|
||||
*bytes_out = bytes_in;
|
||||
}
|
||||
|
||||
void VoEUnitTest::decrypt_rtcp(int channel_no,
|
||||
unsigned char * in_data,
|
||||
unsigned char * out_data,
|
||||
int bytes_in,
|
||||
int * bytes_out)
|
||||
{
|
||||
void VoEUnitTest::decrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in,
|
||||
int * bytes_out) {
|
||||
int i;
|
||||
for (i = 0; i < bytes_in; i++)
|
||||
out_data[i] = in_data[i];
|
||||
*bytes_out = bytes_in;
|
||||
}
|
||||
|
||||
void VoEUnitTest::SetStereoExternalEncryption(int channel,
|
||||
bool onOff,
|
||||
int bitsPerSample)
|
||||
{
|
||||
void VoEUnitTest::SetStereoExternalEncryption(int channel, bool onOff,
|
||||
int bitsPerSample) {
|
||||
_extOnOff = onOff;
|
||||
_extChannel = channel;
|
||||
_extBitsPerSample = bitsPerSample;
|
||||
@ -212,12 +187,8 @@ MyMedia mpobj;
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
VoEUnitTest::VoEUnitTest(VoETestManager& mgr) :
|
||||
_mgr(mgr),
|
||||
_extOnOff(false),
|
||||
_extBitsPerSample(-1)
|
||||
{
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
_mgr(mgr), _extOnOff(false), _extBitsPerSample(-1) {
|
||||
for (int i = 0; i < 32; i++) {
|
||||
_listening[i] = false;
|
||||
_playing[i] = false;
|
||||
_sending[i] = false;
|
||||
@ -228,15 +199,12 @@ VoEUnitTest::VoEUnitTest(VoETestManager& mgr) :
|
||||
// DoTest
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int VoEUnitTest::DoTest()
|
||||
{
|
||||
int VoEUnitTest::DoTest() {
|
||||
int test(-1);
|
||||
int ret(0);
|
||||
while ((test != 0) && (ret != -1))
|
||||
{
|
||||
while ((test != 0) && (ret != -1)) {
|
||||
test = MenuSelection();
|
||||
switch (test)
|
||||
{
|
||||
switch (test) {
|
||||
case 0:
|
||||
// Quit stress test
|
||||
break;
|
||||
@ -260,8 +228,7 @@ int VoEUnitTest::DoTest()
|
||||
// MenuSelection
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int VoEUnitTest::MenuSelection()
|
||||
{
|
||||
int VoEUnitTest::MenuSelection() {
|
||||
printf("------------------------------------------------\n");
|
||||
printf("Select unit test\n\n");
|
||||
printf(" (0) Quit\n");
|
||||
@ -272,12 +239,10 @@ int VoEUnitTest::MenuSelection()
|
||||
const int maxMenuSelection = 2;
|
||||
int selection(-1);
|
||||
|
||||
while ((selection < 0) || (selection > maxMenuSelection))
|
||||
{
|
||||
while ((selection < 0) || (selection > maxMenuSelection)) {
|
||||
printf("\n: ");
|
||||
int retval = scanf("%d", &selection);
|
||||
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection))
|
||||
{
|
||||
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection)) {
|
||||
printf("Invalid selection!\n");
|
||||
}
|
||||
}
|
||||
@ -289,14 +254,8 @@ int VoEUnitTest::MenuSelection()
|
||||
// StartMedia
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int VoEUnitTest::StartMedia(int channel,
|
||||
int rtpPort,
|
||||
bool listen,
|
||||
bool playout,
|
||||
bool send,
|
||||
bool fileAsMic,
|
||||
bool localFile)
|
||||
{
|
||||
int VoEUnitTest::StartMedia(int channel, int rtpPort, bool listen, bool playout,
|
||||
bool send, bool fileAsMic, bool localFile) {
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
VoEFile* file = _mgr.FilePtr();
|
||||
|
||||
@ -306,31 +265,26 @@ int VoEUnitTest::StartMedia(int channel,
|
||||
|
||||
CHECK(base->SetLocalReceiver(channel, rtpPort));
|
||||
CHECK(base->SetSendDestination(channel, rtpPort, "127.0.0.1"));
|
||||
if (listen)
|
||||
{
|
||||
if (listen) {
|
||||
_listening[channel] = true;
|
||||
CHECK(base->StartReceive(channel));
|
||||
}
|
||||
if (playout)
|
||||
{
|
||||
if (playout) {
|
||||
_playing[channel] = true;
|
||||
CHECK(base->StartPlayout(channel));
|
||||
}
|
||||
if (send)
|
||||
{
|
||||
if (send) {
|
||||
_sending[channel] = true;
|
||||
CHECK(base->StartSend(channel));
|
||||
}
|
||||
if (fileAsMic)
|
||||
{
|
||||
if (fileAsMic) {
|
||||
// play mic as file, mix with microphone to ensure that SWB can be
|
||||
//tested as well
|
||||
const bool mixWithMic(true);
|
||||
CHECK(file->StartPlayingFileAsMicrophone(channel, _mgr.AudioFilename(),
|
||||
true, mixWithMic));
|
||||
}
|
||||
if (localFile)
|
||||
{
|
||||
if (localFile) {
|
||||
CHECK(file->StartPlayingFileLocally(channel,
|
||||
GetResource("audio_short16.pcm"),
|
||||
false,
|
||||
@ -344,31 +298,25 @@ int VoEUnitTest::StartMedia(int channel,
|
||||
// StopMedia
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int VoEUnitTest::StopMedia(int channel)
|
||||
{
|
||||
int VoEUnitTest::StopMedia(int channel) {
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
VoEFile* file = _mgr.FilePtr();
|
||||
|
||||
if (file->IsPlayingFileAsMicrophone(channel))
|
||||
{
|
||||
if (file->IsPlayingFileAsMicrophone(channel)) {
|
||||
CHECK(file->StopPlayingFileAsMicrophone(channel));
|
||||
}
|
||||
if (file->IsPlayingFileLocally(channel))
|
||||
{
|
||||
if (file->IsPlayingFileLocally(channel)) {
|
||||
CHECK(file->StopPlayingFileLocally(channel));
|
||||
}
|
||||
if (_listening[channel])
|
||||
{
|
||||
if (_listening[channel]) {
|
||||
_listening[channel] = false;
|
||||
CHECK(base->StopReceive(channel));
|
||||
}
|
||||
if (_playing[channel])
|
||||
{
|
||||
if (_playing[channel]) {
|
||||
_playing[channel] = false;
|
||||
CHECK(base->StopPlayout(channel));
|
||||
}
|
||||
if (_sending[channel])
|
||||
{
|
||||
if (_sending[channel]) {
|
||||
_sending[channel] = false;
|
||||
CHECK(base->StopSend(channel));
|
||||
}
|
||||
@ -376,10 +324,8 @@ int VoEUnitTest::StopMedia(int channel)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VoEUnitTest::Sleep(unsigned int timeMillisec, bool addMarker)
|
||||
{
|
||||
if (addMarker)
|
||||
{
|
||||
void VoEUnitTest::Sleep(unsigned int timeMillisec, bool addMarker) {
|
||||
if (addMarker) {
|
||||
float dtSec = (float) ((float) timeMillisec / 1000.0);
|
||||
printf("[dT=%.1f]", dtSec);
|
||||
fflush(NULL);
|
||||
@ -387,22 +333,21 @@ void VoEUnitTest::Sleep(unsigned int timeMillisec, bool addMarker)
|
||||
::Sleep(timeMillisec);
|
||||
}
|
||||
|
||||
void VoEUnitTest::Wait()
|
||||
{
|
||||
void VoEUnitTest::Wait() {
|
||||
#if defined(_WIN32)
|
||||
printf("\npress any key..."); fflush(NULL);
|
||||
_getch();
|
||||
#endif
|
||||
}
|
||||
|
||||
void VoEUnitTest::Test(const char* msg)
|
||||
{
|
||||
printf("%s", msg); fflush(NULL);
|
||||
printf("\n"); fflush(NULL);
|
||||
void VoEUnitTest::Test(const char* msg) {
|
||||
printf("%s", msg);
|
||||
fflush(NULL);
|
||||
printf("\n");
|
||||
fflush(NULL);
|
||||
}
|
||||
|
||||
int VoEUnitTest::MixerTest()
|
||||
{
|
||||
int VoEUnitTest::MixerTest() {
|
||||
// Set up test parameters first
|
||||
//
|
||||
const int testTime(dTBetweenEachTest);
|
||||
@ -424,12 +369,8 @@ int VoEUnitTest::MixerTest()
|
||||
// Set trace
|
||||
//
|
||||
VoiceEngine::SetTraceFile(GetFilename("UnitTest_Mixer_trace.txt"));
|
||||
VoiceEngine::SetTraceFilter(kTraceStateInfo |
|
||||
kTraceWarning |
|
||||
kTraceError |
|
||||
kTraceCritical |
|
||||
kTraceApiCall |
|
||||
kTraceMemory |
|
||||
VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceWarning | kTraceError |
|
||||
kTraceCritical | kTraceApiCall | kTraceMemory |
|
||||
kTraceInfo);
|
||||
|
||||
// Init
|
||||
@ -437,9 +378,9 @@ int VoEUnitTest::MixerTest()
|
||||
CHECK(base->Init());
|
||||
|
||||
// 8 kHz
|
||||
// CodecInst l16_8 = { 123, "L16", 8000, 160, 1, 128000 };
|
||||
// CodecInst l16_8 = { 123, "L16", 8000, 160, 1, 128000 };
|
||||
CodecInst pcmu_8 = { 0, "pcmu", 8000, 160, 1, 64000 };
|
||||
// CodecInst g729_8 = { 18, "g729", 8000, 160, 1, 8000 };
|
||||
// CodecInst g729_8 = { 18, "g729", 8000, 160, 1, 8000 };
|
||||
|
||||
// 16 kHz
|
||||
CodecInst ipcmwb_16 = { 97, "ipcmwb", 16000, 320, 1, 80000 };
|
||||
@ -928,8 +869,7 @@ int VoEUnitTest::MixerTest()
|
||||
|
||||
base->CreateChannel();
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0)
|
||||
Test("Dtmf direct feedback is now enabled...");
|
||||
else
|
||||
@ -1131,7 +1071,6 @@ int VoEUnitTest::MixerTest()
|
||||
base->DeleteChannel(0);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
CHECK(base->Terminate());
|
||||
|
||||
printf("\n\n------------------------------------------------\n");
|
||||
|
@ -17,14 +17,13 @@ namespace voetest {
|
||||
|
||||
class VoETestManager;
|
||||
|
||||
class VoEUnitTest : public Encryption
|
||||
{
|
||||
public:
|
||||
class VoEUnitTest : public Encryption {
|
||||
public:
|
||||
VoEUnitTest(VoETestManager& mgr);
|
||||
~VoEUnitTest() {};
|
||||
~VoEUnitTest() {}
|
||||
int DoTest();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// Encryption
|
||||
void encrypt(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
@ -35,29 +34,32 @@ protected:
|
||||
void decrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||
|
||||
private:
|
||||
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 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);
|
||||
void SetStereoExternalEncryption(int channel, bool onOff, int bitsPerSample);
|
||||
|
||||
private:
|
||||
private:
|
||||
VoETestManager& _mgr;
|
||||
static const char* _key;
|
||||
|
||||
private:
|
||||
private:
|
||||
bool _listening[32];
|
||||
bool _playing[32];
|
||||
bool _sending[32];
|
||||
|
||||
private:
|
||||
private:
|
||||
bool _extOnOff;
|
||||
int _extBitsPerSample;
|
||||
int _extChannel;
|
||||
|
Loading…
x
Reference in New Issue
Block a user