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
@ -37,14 +37,12 @@ extern int GetResource(char* resource, char* dest, int destLen);
|
|||||||
extern char* GetResource(char* resource);
|
extern char* GetResource(char* resource);
|
||||||
extern const char* GetResource(const char* resource);
|
extern const char* GetResource(const char* resource);
|
||||||
|
|
||||||
VoECpuTest::VoECpuTest(VoETestManager& mgr) :
|
VoECpuTest::VoECpuTest(VoETestManager& mgr)
|
||||||
_mgr(mgr)
|
: _mgr(mgr) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoECpuTest::DoTest()
|
int VoECpuTest::DoTest() {
|
||||||
{
|
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
printf(" CPU Reference Test\n");
|
printf(" CPU Reference Test\n");
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
|
@ -17,11 +17,10 @@ namespace voetest {
|
|||||||
|
|
||||||
class VoETestManager;
|
class VoETestManager;
|
||||||
|
|
||||||
class VoECpuTest
|
class VoECpuTest {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
VoECpuTest(VoETestManager& mgr);
|
VoECpuTest(VoETestManager& mgr);
|
||||||
~VoECpuTest() {};
|
~VoECpuTest() {}
|
||||||
int DoTest();
|
int DoTest();
|
||||||
private:
|
private:
|
||||||
VoETestManager& _mgr;
|
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
|
// Helper methods which allows us to get some handy information about
|
||||||
// this mock implementation.
|
// this mock implementation.
|
||||||
int32_t ReferenceCounter() const { return _ref_count; }
|
int32_t ReferenceCounter() const {
|
||||||
|
return _ref_count;
|
||||||
|
}
|
||||||
|
|
||||||
// RefCountedModule implementation (mocks default implementation)
|
// RefCountedModule implementation (mocks default implementation)
|
||||||
virtual int32_t AddRef();
|
virtual int32_t AddRef();
|
||||||
@ -42,15 +44,28 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
|||||||
|
|
||||||
// Module implementation
|
// Module implementation
|
||||||
virtual int32_t Version(char* version,
|
virtual int32_t Version(char* version,
|
||||||
uint32_t& remaining_buffer_in_bytes, uint32_t& position) const { return 0;}
|
uint32_t& remaining_buffer_in_bytes,
|
||||||
virtual int32_t ChangeUniqueId(const int32_t id) { return 0; }
|
uint32_t& position) const {
|
||||||
virtual int32_t TimeUntilNextProcess() { return -1;}
|
return 0;
|
||||||
virtual int32_t Process() { 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
|
// 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) {
|
virtual int32_t RegisterEventObserver(AudioDeviceObserver* eventCallback) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -59,125 +74,247 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int32_t Init() { return 0; }
|
virtual int32_t Init() {
|
||||||
virtual int32_t Terminate() { return 0; }
|
return 0;
|
||||||
virtual bool Initialized() const { return true; }
|
}
|
||||||
|
virtual int32_t Terminate() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
virtual bool Initialized() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int16_t PlayoutDevices() { return -1; }
|
virtual int16_t PlayoutDevices() {
|
||||||
virtual int16_t RecordingDevices() { return -1; }
|
return -1;
|
||||||
|
}
|
||||||
|
virtual int16_t RecordingDevices() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
virtual int32_t PlayoutDeviceName(uint16_t index,
|
virtual int32_t PlayoutDeviceName(uint16_t index,
|
||||||
char name[kAdmMaxDeviceNameSize],
|
char name[kAdmMaxDeviceNameSize],
|
||||||
char guid[kAdmMaxGuidSize]) { return -1; }
|
char guid[kAdmMaxGuidSize]) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
virtual int32_t RecordingDeviceName(uint16_t index,
|
virtual int32_t RecordingDeviceName(uint16_t index,
|
||||||
char name[kAdmMaxDeviceNameSize],
|
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(uint16_t index) {
|
||||||
virtual int32_t SetPlayoutDevice(WindowsDeviceType device) { return 0; }
|
return 0;
|
||||||
virtual int32_t SetRecordingDevice(uint16_t index) { return 0; }
|
}
|
||||||
virtual int32_t SetRecordingDevice(WindowsDeviceType device) { 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) {
|
virtual int32_t PlayoutIsAvailable(bool* available) {
|
||||||
*available = true;
|
*available = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual int32_t InitPlayout() { return 0; }
|
virtual int32_t InitPlayout() {
|
||||||
virtual bool PlayoutIsInitialized() const { return true; }
|
return 0;
|
||||||
|
}
|
||||||
|
virtual bool PlayoutIsInitialized() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
virtual int32_t RecordingIsAvailable(bool* available) {
|
virtual int32_t RecordingIsAvailable(bool* available) {
|
||||||
*available = true;
|
*available = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual int32_t InitRecording() { return 0; }
|
virtual int32_t InitRecording() {
|
||||||
virtual bool RecordingIsInitialized() const { return true; }
|
return 0;
|
||||||
|
}
|
||||||
|
virtual bool RecordingIsInitialized() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int32_t StartPlayout() { return 0; }
|
virtual int32_t StartPlayout() {
|
||||||
virtual int32_t StopPlayout() { return 0; }
|
return 0;
|
||||||
virtual bool Playing() const { return true; }
|
}
|
||||||
virtual int32_t StartRecording() { return 0; }
|
virtual int32_t StopPlayout() {
|
||||||
virtual int32_t StopRecording() { return 0; }
|
return 0;
|
||||||
virtual bool Recording() const { return true; }
|
}
|
||||||
|
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 int32_t SetAGC(bool enable) {
|
||||||
virtual bool AGC() const { return false; }
|
return -1;
|
||||||
|
}
|
||||||
|
virtual bool AGC() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int32_t SetWaveOutVolume(uint16_t volumeLeft,
|
virtual int32_t SetWaveOutVolume(uint16_t volumeLeft,
|
||||||
uint16_t volumeRight) { return -1; }
|
uint16_t volumeRight) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
virtual int32_t WaveOutVolume(uint16_t* volumeLeft,
|
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) {
|
virtual int32_t SpeakerIsAvailable(bool* available) {
|
||||||
*available = true;
|
*available = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual int32_t InitSpeaker() { return 0; }
|
virtual int32_t InitSpeaker() {
|
||||||
virtual bool SpeakerIsInitialized() const { return true; }
|
return 0;
|
||||||
|
}
|
||||||
|
virtual bool SpeakerIsInitialized() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
virtual int32_t MicrophoneIsAvailable(bool* available) {
|
virtual int32_t MicrophoneIsAvailable(bool* available) {
|
||||||
*available = true;
|
*available = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual int32_t InitMicrophone() { return 0; }
|
virtual int32_t InitMicrophone() {
|
||||||
virtual bool MicrophoneIsInitialized() const { return true; }
|
return 0;
|
||||||
|
}
|
||||||
|
virtual bool MicrophoneIsInitialized() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int32_t SpeakerVolumeIsAvailable(bool* available) { return -1; }
|
virtual int32_t SpeakerVolumeIsAvailable(bool* available) {
|
||||||
virtual int32_t SetSpeakerVolume(uint32_t volume) { return -1; }
|
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 SetSpeakerVolume(uint32_t volume) {
|
||||||
virtual int32_t MinSpeakerVolume(uint32_t* minVolume) const { return -1; }
|
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 SpeakerVolumeStepSize(uint16_t* stepSize) const {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int32_t MicrophoneVolumeIsAvailable(bool* available) { return -1; }
|
virtual int32_t MicrophoneVolumeIsAvailable(bool* available) {
|
||||||
virtual int32_t SetMicrophoneVolume(uint32_t volume) { return -1; }
|
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 SetMicrophoneVolume(uint32_t volume) {
|
||||||
virtual int32_t MinMicrophoneVolume(uint32_t* minVolume) const { return -1; }
|
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 MicrophoneVolumeStepSize(uint16_t* stepSize) const {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int32_t SpeakerMuteIsAvailable(bool* available) { return -1; }
|
virtual int32_t SpeakerMuteIsAvailable(bool* available) {
|
||||||
virtual int32_t SetSpeakerMute(bool enable) { return -1; }
|
return -1;
|
||||||
virtual int32_t SpeakerMute(bool* enabled) const { 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 MicrophoneMuteIsAvailable(bool* available) {
|
||||||
virtual int32_t SetMicrophoneMute(bool enable) { return -1; }
|
return -1;
|
||||||
virtual int32_t MicrophoneMute(bool* enabled) const { 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 MicrophoneBoostIsAvailable(bool* available) {
|
||||||
virtual int32_t SetMicrophoneBoost(bool enable) { return -1; }
|
return -1;
|
||||||
virtual int32_t MicrophoneBoost(bool* enabled) const { 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 {
|
virtual int32_t StereoPlayoutIsAvailable(bool* available) 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 SetStereoPlayout(bool enable) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
virtual int32_t StereoPlayout(bool* enabled) const {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
virtual int32_t StereoRecordingIsAvailable(bool* available) const {
|
virtual int32_t StereoRecordingIsAvailable(bool* available) const {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
virtual int32_t SetStereoRecording(bool enable) { return -1; }
|
virtual int32_t SetStereoRecording(bool enable) {
|
||||||
virtual int32_t StereoRecording(bool* enabled) const { return -1; }
|
return -1;
|
||||||
|
}
|
||||||
|
virtual int32_t StereoRecording(bool* enabled) const {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
virtual int32_t SetRecordingChannel(const ChannelType channel) {
|
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,
|
virtual int32_t SetPlayoutBuffer(const BufferType type, uint16_t sizeMS = 0) {
|
||||||
uint16_t sizeMS = 0) { return -1; }
|
return -1;
|
||||||
|
}
|
||||||
virtual int32_t PlayoutBuffer(BufferType* type, uint16_t* sizeMS) const {
|
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 PlayoutDelay(uint16_t* delayMS) const {
|
||||||
virtual int32_t RecordingDelay(uint16_t* delayMS) const { return -1; }
|
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(
|
virtual int32_t StartRawOutputFileRecording(
|
||||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { return -1; }
|
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
|
||||||
virtual int32_t StopRawOutputFileRecording() { return -1; }
|
return -1;
|
||||||
|
}
|
||||||
|
virtual int32_t StopRawOutputFileRecording() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
virtual int32_t StartRawInputFileRecording(
|
virtual int32_t StartRawInputFileRecording(
|
||||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { return -1; }
|
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
|
||||||
virtual int32_t StopRawInputFileRecording() { return -1; }
|
return -1;
|
||||||
|
}
|
||||||
|
virtual int32_t StopRawInputFileRecording() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) {
|
virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -192,9 +329,15 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int32_t ResetAudioDevice() { return -1; }
|
virtual int32_t ResetAudioDevice() {
|
||||||
virtual int32_t SetLoudspeakerStatus(bool enable) { return -1; }
|
return -1;
|
||||||
virtual int32_t GetLoudspeakerStatus(bool* enabled) const { return -1; }
|
}
|
||||||
|
virtual int32_t SetLoudspeakerStatus(bool enable) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
virtual int32_t GetLoudspeakerStatus(bool* enabled) const {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AudioDeviceModuleImpl();
|
AudioDeviceModuleImpl();
|
||||||
@ -208,41 +351,43 @@ private:
|
|||||||
// Transport
|
// Transport
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class ExtendedTestTransport : public Transport
|
class ExtendedTestTransport : public Transport {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
ExtendedTestTransport(VoENetwork* ptr);
|
ExtendedTestTransport(VoENetwork* ptr);
|
||||||
~ExtendedTestTransport();
|
~ExtendedTestTransport();
|
||||||
VoENetwork* myNetw;
|
VoENetwork* myNetw;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int SendPacket(int channel, const void *data, int len);
|
virtual int SendPacket(int channel, const void *data, int len);
|
||||||
virtual int SendRTCPPacket(int channel, const void *data, int len);
|
virtual int SendRTCPPacket(int channel, const void *data, int len);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool Run(void* ptr);
|
static bool Run(void* ptr);
|
||||||
bool Process();
|
bool Process();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThreadWrapper* _thread;
|
ThreadWrapper* _thread;
|
||||||
CriticalSectionWrapper* _lock;
|
CriticalSectionWrapper* _lock;
|
||||||
EventWrapper* _event;
|
EventWrapper* _event;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned char _packetBuffer[1612];
|
unsigned char _packetBuffer[1612];
|
||||||
int _length;
|
int _length;
|
||||||
int _channel;
|
int _channel;
|
||||||
};
|
};
|
||||||
|
|
||||||
class XTransport : public Transport
|
class XTransport : public Transport {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
XTransport(VoENetwork* netw, VoEFile* file);
|
XTransport(VoENetwork* netw, VoEFile* file);
|
||||||
VoENetwork* _netw;
|
VoENetwork* _netw;
|
||||||
VoEFile* _file;
|
VoEFile* _file;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int SendPacket(int channel, const void *data, int len);
|
virtual int SendPacket(int channel, const void *data, int len);
|
||||||
virtual int SendRTCPPacket(int channel, const void *data, int len);
|
virtual int SendRTCPPacket(int channel, const void *data, int len);
|
||||||
};
|
};
|
||||||
|
|
||||||
class XRTPObserver : public VoERTPObserver
|
class XRTPObserver : public VoERTPObserver {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
XRTPObserver();
|
XRTPObserver();
|
||||||
~XRTPObserver();
|
~XRTPObserver();
|
||||||
@ -260,8 +405,7 @@ public:
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class VoEExtendedTest : public VoiceEngineObserver,
|
class VoEExtendedTest : public VoiceEngineObserver,
|
||||||
public VoEConnectionObserver
|
public VoEConnectionObserver {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
VoEExtendedTest(VoETestManager& mgr);
|
VoEExtendedTest(VoETestManager& mgr);
|
||||||
~VoEExtendedTest();
|
~VoEExtendedTest();
|
||||||
@ -283,40 +427,26 @@ public:
|
|||||||
int TestVolumeControl();
|
int TestVolumeControl();
|
||||||
int TestAPM();
|
int TestAPM();
|
||||||
public:
|
public:
|
||||||
int ErrorCode() const
|
int ErrorCode() const {
|
||||||
{
|
|
||||||
return _errCode;
|
return _errCode;
|
||||||
}
|
}
|
||||||
;
|
void ClearErrorCode() {
|
||||||
void ClearErrorCode()
|
|
||||||
{
|
|
||||||
_errCode = 0;
|
_errCode = 0;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
protected:
|
protected:
|
||||||
// from VoiceEngineObserver
|
// from VoiceEngineObserver
|
||||||
void CallbackOnError(const int errCode, const int channel);
|
void CallbackOnError(const int errCode, const int channel);
|
||||||
void CallbackOnTrace(const TraceLevel level,
|
void CallbackOnTrace(const TraceLevel level, const char* message, const int length);
|
||||||
const char* message,
|
|
||||||
const int length);
|
|
||||||
protected:
|
protected:
|
||||||
// from VoEConnectionObserver
|
// from VoEConnectionObserver
|
||||||
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
||||||
private:
|
private:
|
||||||
void Play(int channel,
|
void Play(int channel, unsigned int timeMillisec, bool addFileAsMicrophone = false,
|
||||||
unsigned int timeMillisec,
|
|
||||||
bool addFileAsMicrophone = false,
|
|
||||||
bool addTimeMarker = false);
|
bool addTimeMarker = false);
|
||||||
void Sleep(unsigned int timeMillisec, bool addMarker = false);
|
void Sleep(unsigned int timeMillisec, bool addMarker = false);
|
||||||
void StartMedia(int channel,
|
void StartMedia(int channel, int rtpPort, bool listen, bool playout, bool send);
|
||||||
int rtpPort,
|
|
||||||
bool listen,
|
|
||||||
bool playout,
|
|
||||||
bool send);
|
|
||||||
void StopMedia(int channel);
|
void StopMedia(int channel);
|
||||||
int RunMixingTest(int num_channels,
|
int RunMixingTest(int num_channels, int16_t input_value, int16_t max_output_value,
|
||||||
int16_t input_value,
|
|
||||||
int16_t max_output_value,
|
|
||||||
int16_t min_output_value);
|
int16_t min_output_value);
|
||||||
private:
|
private:
|
||||||
VoETestManager& _mgr;
|
VoETestManager& _mgr;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -49,8 +49,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _TEST_NETEQ_STATS_
|
#ifdef _TEST_NETEQ_STATS_
|
||||||
namespace webrtc
|
namespace webrtc {
|
||||||
{
|
|
||||||
class CriticalSectionWrapper;
|
class CriticalSectionWrapper;
|
||||||
class ThreadWrapper;
|
class ThreadWrapper;
|
||||||
class VoENetEqStats;
|
class VoENetEqStats;
|
||||||
@ -61,14 +60,12 @@ class VoENetEqStats;
|
|||||||
extern char mobileLogMsg[640];
|
extern char mobileLogMsg[640];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace voetest
|
namespace voetest {
|
||||||
{
|
|
||||||
|
|
||||||
void createSummary(VoiceEngine* ve);
|
void createSummary(VoiceEngine* ve);
|
||||||
void prepareDelivery();
|
void prepareDelivery();
|
||||||
|
|
||||||
class MyRTPObserver: public VoERTPObserver
|
class MyRTPObserver : public VoERTPObserver {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
MyRTPObserver();
|
MyRTPObserver();
|
||||||
~MyRTPObserver();
|
~MyRTPObserver();
|
||||||
@ -85,21 +82,17 @@ public:
|
|||||||
int _size[2];
|
int _size[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyTraceCallback: public TraceCallback
|
class MyTraceCallback : public TraceCallback {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
void Print(const TraceLevel level, const char *traceString,
|
void Print(const TraceLevel level, const char *traceString, const int length);
|
||||||
const int length);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyDeadOrAlive: public VoEConnectionObserver
|
class MyDeadOrAlive : public VoEConnectionObserver {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ErrorObserver: public VoiceEngineObserver
|
class ErrorObserver : public VoiceEngineObserver {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
ErrorObserver();
|
ErrorObserver();
|
||||||
void CallbackOnError(const int channel, const int errCode);
|
void CallbackOnError(const int channel, const int errCode);
|
||||||
@ -107,8 +100,7 @@ public:
|
|||||||
int code;
|
int code;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RtcpAppHandler: public VoERTCPObserver
|
class RtcpAppHandler : public VoERTCPObserver {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
void OnApplicationDataReceived(const int channel,
|
void OnApplicationDataReceived(const int channel,
|
||||||
const unsigned char subType,
|
const unsigned char subType,
|
||||||
@ -116,27 +108,22 @@ public:
|
|||||||
const unsigned char* data,
|
const unsigned char* data,
|
||||||
const unsigned short dataLengthInBytes);
|
const unsigned short dataLengthInBytes);
|
||||||
void Reset();
|
void Reset();
|
||||||
~RtcpAppHandler()
|
~RtcpAppHandler() {}
|
||||||
{
|
|
||||||
};
|
|
||||||
unsigned short _lengthBytes;
|
unsigned short _lengthBytes;
|
||||||
unsigned char _data[256];
|
unsigned char _data[256];
|
||||||
unsigned char _subType;
|
unsigned char _subType;
|
||||||
unsigned int _name;
|
unsigned int _name;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DtmfCallback: public VoETelephoneEventObserver
|
class DtmfCallback : public VoETelephoneEventObserver {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
int counter;
|
int counter;
|
||||||
DtmfCallback()
|
DtmfCallback() {
|
||||||
{
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
}
|
}
|
||||||
virtual void OnReceivedTelephoneEventInband(int channel,
|
virtual void OnReceivedTelephoneEventInband(int channel,
|
||||||
int eventCode,
|
int eventCode,
|
||||||
bool endOfEvent)
|
bool endOfEvent) {
|
||||||
{
|
|
||||||
char msg[128];
|
char msg[128];
|
||||||
if (endOfEvent)
|
if (endOfEvent)
|
||||||
sprintf(msg, "(event=%d, [END])", eventCode);
|
sprintf(msg, "(event=%d, [END])", eventCode);
|
||||||
@ -148,11 +135,9 @@ public:
|
|||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnReceivedTelephoneEventOutOfBand(
|
virtual void OnReceivedTelephoneEventOutOfBand(int channel,
|
||||||
int channel,
|
|
||||||
int eventCode,
|
int eventCode,
|
||||||
bool endOfEvent)
|
bool endOfEvent) {
|
||||||
{
|
|
||||||
char msg[128];
|
char msg[128];
|
||||||
if (endOfEvent)
|
if (endOfEvent)
|
||||||
sprintf(msg, "(event=%d, [END])", eventCode);
|
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,
|
void encrypt(int channel_no, unsigned char * in_data,
|
||||||
unsigned char * out_data, int bytes_in, int * bytes_out);
|
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||||
void decrypt(int channel_no, unsigned char * in_data,
|
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);
|
unsigned char * out_data, int bytes_in, int * bytes_out);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RxCallback: public VoERxVadCallback
|
class RxCallback : public VoERxVadCallback {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
RxCallback() :
|
RxCallback() :
|
||||||
_vadDecision(-1)
|
_vadDecision(-1) {
|
||||||
{
|
}
|
||||||
};
|
|
||||||
|
|
||||||
virtual void OnRxVad(int, int vadDecision)
|
virtual void OnRxVad(int, int vadDecision) {
|
||||||
{
|
|
||||||
char msg[128];
|
char msg[128];
|
||||||
sprintf(msg, "RX VAD detected decision %d \n", vadDecision);
|
sprintf(msg, "RX VAD detected decision %d \n", vadDecision);
|
||||||
TEST_LOG("%s", msg);
|
TEST_LOG("%s", msg);
|
||||||
@ -197,22 +178,23 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
|
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
|
||||||
class MyMedia: public VoEMediaProcess
|
class MyMedia : public VoEMediaProcess {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual void Process(const int channel, const ProcessingTypes type,
|
virtual void Process(const int channel,
|
||||||
WebRtc_Word16 audio_10ms[], const int length,
|
const ProcessingTypes type,
|
||||||
const int samplingFreqHz, const bool stereo);
|
WebRtc_Word16 audio_10ms[],
|
||||||
|
const int length,
|
||||||
|
const int samplingFreqHz,
|
||||||
|
const bool stereo);
|
||||||
private:
|
private:
|
||||||
int f;
|
int f;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class SubAPIManager
|
class SubAPIManager {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
SubAPIManager() :
|
SubAPIManager()
|
||||||
_base(true),
|
: _base(true),
|
||||||
_callReport(false),
|
_callReport(false),
|
||||||
_codec(false),
|
_codec(false),
|
||||||
_dtmf(false),
|
_dtmf(false),
|
||||||
@ -226,8 +208,7 @@ public:
|
|||||||
_videoSync(false),
|
_videoSync(false),
|
||||||
_volumeControl(false),
|
_volumeControl(false),
|
||||||
_apm(false),
|
_apm(false),
|
||||||
_xsel(XSEL_Invalid)
|
_xsel(XSEL_Invalid) {
|
||||||
{
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_CALL_REPORT_API
|
#ifdef WEBRTC_VOICE_ENGINE_CALL_REPORT_API
|
||||||
_callReport = true;
|
_callReport = true;
|
||||||
#endif
|
#endif
|
||||||
@ -267,7 +248,7 @@ public:
|
|||||||
#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
|
#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
|
||||||
_apm = true;
|
_apm = true;
|
||||||
#endif
|
#endif
|
||||||
};
|
}
|
||||||
|
|
||||||
void DisplayStatus() const;
|
void DisplayStatus() const;
|
||||||
bool GetExtendedMenuSelection(ExtendedSelection& sel);
|
bool GetExtendedMenuSelection(ExtendedSelection& sel);
|
||||||
@ -279,8 +260,7 @@ private:
|
|||||||
ExtendedSelection _xsel;
|
ExtendedSelection _xsel;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VoETestManager
|
class VoETestManager {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
VoETestManager();
|
VoETestManager();
|
||||||
~VoETestManager();
|
~VoETestManager();
|
||||||
@ -292,72 +272,65 @@ public:
|
|||||||
int ReleaseInterfaces();
|
int ReleaseInterfaces();
|
||||||
int DoStandardTest();
|
int DoStandardTest();
|
||||||
|
|
||||||
const char* AudioFilename() const
|
const char* AudioFilename() const {
|
||||||
{
|
|
||||||
return audioFilename_.c_str();
|
return audioFilename_.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
VoiceEngine* VoiceEnginePtr() const
|
VoiceEngine* VoiceEnginePtr() const {
|
||||||
{
|
|
||||||
return ve;
|
return ve;
|
||||||
};
|
}
|
||||||
VoEBase* BasePtr() const
|
VoEBase* BasePtr() const {
|
||||||
{
|
|
||||||
return base;
|
return base;
|
||||||
};
|
}
|
||||||
VoECodec* CodecPtr() const
|
VoECodec* CodecPtr() const {
|
||||||
{
|
|
||||||
return codec;
|
return codec;
|
||||||
};
|
}
|
||||||
VoEVolumeControl* VolumeControlPtr() const
|
VoEVolumeControl* VolumeControlPtr() const {
|
||||||
{
|
|
||||||
return volume;
|
return volume;
|
||||||
};
|
}
|
||||||
VoEDtmf* DtmfPtr() const
|
VoEDtmf* DtmfPtr() const {
|
||||||
{
|
|
||||||
return dtmf;
|
return dtmf;
|
||||||
};
|
}
|
||||||
VoERTP_RTCP* RTP_RTCPPtr() const
|
VoERTP_RTCP* RTP_RTCPPtr() const {
|
||||||
{
|
|
||||||
return rtp_rtcp;
|
return rtp_rtcp;
|
||||||
};
|
}
|
||||||
VoEAudioProcessing* APMPtr() const
|
VoEAudioProcessing* APMPtr() const {
|
||||||
{
|
|
||||||
return apm;
|
return apm;
|
||||||
};
|
}
|
||||||
VoENetwork* NetworkPtr() const
|
|
||||||
{
|
VoENetwork* NetworkPtr() const {
|
||||||
return netw;
|
return netw;
|
||||||
};
|
}
|
||||||
VoEFile* FilePtr() const
|
|
||||||
{
|
VoEFile* FilePtr() const {
|
||||||
return file;
|
return file;
|
||||||
};
|
}
|
||||||
VoEHardware* HardwarePtr() const
|
|
||||||
{
|
VoEHardware* HardwarePtr() const {
|
||||||
return hardware;
|
return hardware;
|
||||||
};
|
}
|
||||||
VoEVideoSync* VideoSyncPtr() const
|
|
||||||
{
|
VoEVideoSync* VideoSyncPtr() const {
|
||||||
return vsync;
|
return vsync;
|
||||||
};
|
}
|
||||||
VoEEncryption* EncryptionPtr() const
|
|
||||||
{
|
VoEEncryption* EncryptionPtr() const {
|
||||||
return encrypt;
|
return encrypt;
|
||||||
};
|
}
|
||||||
VoEExternalMedia* ExternalMediaPtr() const
|
|
||||||
{
|
VoEExternalMedia* ExternalMediaPtr() const {
|
||||||
return xmedia;
|
return xmedia;
|
||||||
};
|
}
|
||||||
VoECallReport* CallReportPtr() const
|
|
||||||
{
|
VoECallReport* CallReportPtr() const {
|
||||||
return report;
|
return report;
|
||||||
};
|
}
|
||||||
|
|
||||||
#ifdef _TEST_NETEQ_STATS_
|
#ifdef _TEST_NETEQ_STATS_
|
||||||
VoENetEqStats* NetEqStatsPtr() const
|
VoENetEqStats* NetEqStatsPtr() const {
|
||||||
{
|
|
||||||
return neteqst;
|
return neteqst;
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "voe_standard_test.h"
|
#include "voe_standard_test.h"
|
||||||
|
|
||||||
#include "../../source/voice_engine_defines.h" // defines build macros
|
#include "../../source/voice_engine_defines.h" // defines build macros
|
||||||
|
|
||||||
#include "thread_wrapper.h"
|
#include "thread_wrapper.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
@ -54,7 +53,6 @@ extern int GetResource(char* resource, char* dest, int destLen);
|
|||||||
extern char* GetResource(char* resource);
|
extern char* GetResource(char* resource);
|
||||||
extern const char* GetResource(const char* resource);
|
extern const char* GetResource(const char* resource);
|
||||||
|
|
||||||
|
|
||||||
const char* VoEStressTest::_key = "====YUtFWRAAAAADBtIHgAAAAAEAAAAcAAAAAQBHU0ds"
|
const char* VoEStressTest::_key = "====YUtFWRAAAAADBtIHgAAAAAEAAAAcAAAAAQBHU0ds"
|
||||||
"b2JhbCBJUCBTb3VuZAAC\nAAAAIwAAAExpY2Vuc2VkIHRvIE5vcnRlbCBOZXR3cm9rcwAAAAA"
|
"b2JhbCBJUCBTb3VuZAAC\nAAAAIwAAAExpY2Vuc2VkIHRvIE5vcnRlbCBOZXR3cm9rcwAAAAA"
|
||||||
"xAAAAZxZ7/u0M\niFYyTwSwko5Uutf7mh8S0O4rYZYTFidbzQeuGonuL17F/2oD/2pfDp3jL4"
|
"xAAAAZxZ7/u0M\niFYyTwSwko5Uutf7mh8S0O4rYZYTFidbzQeuGonuL17F/2oD/2pfDp3jL4"
|
||||||
@ -62,15 +60,11 @@ const char* VoEStressTest::_key = "====YUtFWRAAAAADBtIHgAAAAAEAAAAcAAAAAQBHU0ds"
|
|||||||
"\nOrs3sIuwdYK5va/aFcsjBDmlsGCUM48RDYG9s23bIHYafXUC4ofOaubbZPWiPTmL\nEVJ8WH"
|
"\nOrs3sIuwdYK5va/aFcsjBDmlsGCUM48RDYG9s23bIHYafXUC4ofOaubbZPWiPTmL\nEVJ8WH"
|
||||||
"4F9pgNjALc14oJXfON7r/3\n=EsLx";
|
"4F9pgNjALc14oJXfON7r/3\n=EsLx";
|
||||||
|
|
||||||
|
int VoEStressTest::DoTest() {
|
||||||
int VoEStressTest::DoTest()
|
|
||||||
{
|
|
||||||
int test(-1);
|
int test(-1);
|
||||||
while (test != 0)
|
while (test != 0) {
|
||||||
{
|
|
||||||
test = MenuSelection();
|
test = MenuSelection();
|
||||||
switch (test)
|
switch (test) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
// Quit stress test
|
// Quit stress test
|
||||||
break;
|
break;
|
||||||
@ -99,9 +93,7 @@ int VoEStressTest::DoTest()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VoEStressTest::MenuSelection() {
|
||||||
int VoEStressTest::MenuSelection()
|
|
||||||
{
|
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
printf("Select stress test\n\n");
|
printf("Select stress test\n\n");
|
||||||
printf(" (0) Quit\n");
|
printf(" (0) Quit\n");
|
||||||
@ -114,12 +106,10 @@ int VoEStressTest::MenuSelection()
|
|||||||
const int maxMenuSelection = 4;
|
const int maxMenuSelection = 4;
|
||||||
int selection(-1);
|
int selection(-1);
|
||||||
|
|
||||||
while ((selection < 0) || (selection > maxMenuSelection))
|
while ((selection < 0) || (selection > maxMenuSelection)) {
|
||||||
{
|
|
||||||
printf("\n: ");
|
printf("\n: ");
|
||||||
int retval = scanf("%d", &selection);
|
int retval = scanf("%d", &selection);
|
||||||
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection))
|
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection)) {
|
||||||
{
|
|
||||||
printf("Invalid selection!\n");
|
printf("Invalid selection!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,9 +117,7 @@ int VoEStressTest::MenuSelection()
|
|||||||
return selection;
|
return selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VoEStressTest::StartStopTest() {
|
||||||
int VoEStressTest::StartStopTest()
|
|
||||||
{
|
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
printf("Running start/stop test\n");
|
printf("Running start/stop test\n");
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
@ -149,11 +137,9 @@ int VoEStressTest::StartStopTest()
|
|||||||
// kTraceWarning | kTraceError |
|
// kTraceWarning | kTraceError |
|
||||||
// kTraceCritical | kTraceApiCall |
|
// kTraceCritical | kTraceApiCall |
|
||||||
// kTraceMemory | kTraceInfo));
|
// kTraceMemory | kTraceInfo));
|
||||||
|
|
||||||
VALIDATE_STRESS(base->Init());
|
VALIDATE_STRESS(base->Init());
|
||||||
VALIDATE_STRESS(base->CreateChannel());
|
VALIDATE_STRESS(base->CreateChannel());
|
||||||
|
|
||||||
|
|
||||||
///////////// Start test /////////////
|
///////////// Start test /////////////
|
||||||
|
|
||||||
int numberOfLoops(2000);
|
int numberOfLoops(2000);
|
||||||
@ -166,14 +152,14 @@ int VoEStressTest::StartStopTest()
|
|||||||
printf("Test will take approximately %d minutes. \n",
|
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->SetLocalReceiver(0, 4800));
|
||||||
VALIDATE_STRESS(base->SetSendDestination(0, 4800, "127.0.0.1"));
|
VALIDATE_STRESS(base->SetSendDestination(0, 4800, "127.0.0.1"));
|
||||||
VALIDATE_STRESS(base->StartReceive(0));
|
VALIDATE_STRESS(base->StartReceive(0));
|
||||||
VALIDATE_STRESS(base->StartPlayout(0));
|
VALIDATE_STRESS(base->StartPlayout(0));
|
||||||
VALIDATE_STRESS(base->StartSend(0));
|
VALIDATE_STRESS(base->StartSend(0));
|
||||||
if (!(i % markInterval)) MARK();
|
if (!(i % markInterval))
|
||||||
|
MARK();
|
||||||
SLEEP(loopSleep);
|
SLEEP(loopSleep);
|
||||||
VALIDATE_STRESS(base->StopSend(0));
|
VALIDATE_STRESS(base->StopSend(0));
|
||||||
VALIDATE_STRESS(base->StopPlayout(0));
|
VALIDATE_STRESS(base->StopPlayout(0));
|
||||||
@ -204,9 +190,7 @@ int VoEStressTest::StartStopTest()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VoEStressTest::CreateDeleteChannelsTest() {
|
||||||
int VoEStressTest::CreateDeleteChannelsTest()
|
|
||||||
{
|
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
printf("Running create/delete channels test\n");
|
printf("Running create/delete channels test\n");
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
@ -223,7 +207,6 @@ int VoEStressTest::CreateDeleteChannelsTest()
|
|||||||
// kTraceWarning | kTraceError |
|
// kTraceWarning | kTraceError |
|
||||||
// kTraceCritical | kTraceApiCall |
|
// kTraceCritical | kTraceApiCall |
|
||||||
// kTraceMemory | kTraceInfo));
|
// kTraceMemory | kTraceInfo));
|
||||||
|
|
||||||
VALIDATE_STRESS(base->Init());
|
VALIDATE_STRESS(base->Init());
|
||||||
|
|
||||||
///////////// Start test /////////////
|
///////////// Start test /////////////
|
||||||
@ -252,12 +235,10 @@ int VoEStressTest::CreateDeleteChannelsTest()
|
|||||||
memset(channelState, 0, maxChannels * sizeof(bool));
|
memset(channelState, 0, maxChannels * sizeof(bool));
|
||||||
int channel(0);
|
int channel(0);
|
||||||
int noOfActiveChannels(0);
|
int noOfActiveChannels(0);
|
||||||
for (i=0; i<(maxChannels/2); ++i)
|
for (i = 0; i < (maxChannels / 2); ++i) {
|
||||||
{
|
|
||||||
channel = base->CreateChannel();
|
channel = base->CreateChannel();
|
||||||
VALIDATE_STRESS(channel < 0);
|
VALIDATE_STRESS(channel < 0);
|
||||||
if (channel >= 0)
|
if (channel >= 0) {
|
||||||
{
|
|
||||||
channelState[channel] = true;
|
channelState[channel] = true;
|
||||||
++noOfActiveChannels;
|
++noOfActiveChannels;
|
||||||
}
|
}
|
||||||
@ -268,47 +249,40 @@ int VoEStressTest::CreateDeleteChannelsTest()
|
|||||||
int res(0);
|
int res(0);
|
||||||
|
|
||||||
// Create/delete channels with slight
|
// Create/delete channels with slight
|
||||||
for (i=0; i<numberOfLoops; ++i)
|
for (i = 0; i < numberOfLoops; ++i) {
|
||||||
{
|
|
||||||
// Randomize action (create or delete channel)
|
// Randomize action (create or delete channel)
|
||||||
action = rand() <= (RAND_MAX / 2);
|
action = rand() <= (RAND_MAX / 2);
|
||||||
if (action)
|
if (action) {
|
||||||
{
|
if (noOfActiveChannels < maxChannels) {
|
||||||
if (noOfActiveChannels < maxChannels)
|
|
||||||
{
|
|
||||||
// Create new channel
|
// Create new channel
|
||||||
channel = base->CreateChannel();
|
channel = base->CreateChannel();
|
||||||
VALIDATE_STRESS(channel < 0);
|
VALIDATE_STRESS(channel < 0);
|
||||||
if (channel >= 0)
|
if (channel >= 0) {
|
||||||
{
|
|
||||||
channelState[channel] = true;
|
channelState[channel] = true;
|
||||||
++noOfActiveChannels;
|
++noOfActiveChannels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if (noOfActiveChannels > 0) {
|
||||||
{
|
|
||||||
if (noOfActiveChannels > 0)
|
|
||||||
{
|
|
||||||
// Delete random channel that's created [0, maxChannels - 1]
|
// Delete random channel that's created [0, maxChannels - 1]
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
rnd = static_cast<double> (rand());
|
rnd = static_cast<double> (rand());
|
||||||
channel = static_cast<int> (rnd /
|
channel = static_cast<int> (rnd /
|
||||||
(static_cast<double>(RAND_MAX) + 1.0f) * maxChannels);
|
(static_cast<double> (RAND_MAX) + 1.0f) *
|
||||||
|
maxChannels);
|
||||||
} while (!channelState[channel]); // Must find a created channel
|
} while (!channelState[channel]); // Must find a created channel
|
||||||
|
|
||||||
res = base->DeleteChannel(channel);
|
res = base->DeleteChannel(channel);
|
||||||
VALIDATE_STRESS(0 != res);
|
VALIDATE_STRESS(0 != res);
|
||||||
if (0 == res)
|
if (0 == res) {
|
||||||
{
|
|
||||||
channelState[channel] = false;
|
channelState[channel] = false;
|
||||||
--noOfActiveChannels;
|
--noOfActiveChannels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(i % markInterval)) MARK();
|
if (!(i % markInterval))
|
||||||
|
MARK();
|
||||||
SLEEP(loopSleep);
|
SLEEP(loopSleep);
|
||||||
}
|
}
|
||||||
ANL();
|
ANL();
|
||||||
@ -326,9 +300,7 @@ int VoEStressTest::CreateDeleteChannelsTest()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VoEStressTest::MultipleThreadsTest() {
|
||||||
int VoEStressTest::MultipleThreadsTest()
|
|
||||||
{
|
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
printf("Running multiple threads test\n");
|
printf("Running multiple threads test\n");
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
@ -350,7 +322,6 @@ int VoEStressTest::MultipleThreadsTest()
|
|||||||
VALIDATE_STRESS(base->Init());
|
VALIDATE_STRESS(base->Init());
|
||||||
VALIDATE_STRESS(base->CreateChannel());
|
VALIDATE_STRESS(base->CreateChannel());
|
||||||
|
|
||||||
|
|
||||||
///////////// Start test /////////////
|
///////////// Start test /////////////
|
||||||
|
|
||||||
int numberOfLoops(10000);
|
int numberOfLoops(10000);
|
||||||
@ -368,8 +339,8 @@ int VoEStressTest::MultipleThreadsTest()
|
|||||||
|
|
||||||
// Start extra thread
|
// Start extra thread
|
||||||
const char* threadName = "StressTest Extra API Thread";
|
const char* threadName = "StressTest Extra API Thread";
|
||||||
_ptrExtraApiThread = ThreadWrapper::CreateThread(
|
_ptrExtraApiThread = ThreadWrapper::CreateThread(RunExtraApi, this,
|
||||||
RunExtraApi, this, kNormalPriority, threadName);
|
kNormalPriority, threadName);
|
||||||
unsigned int id(0);
|
unsigned int id(0);
|
||||||
VALIDATE_STRESS(!_ptrExtraApiThread->Start(id));
|
VALIDATE_STRESS(!_ptrExtraApiThread->Start(id));
|
||||||
|
|
||||||
@ -380,24 +351,21 @@ int VoEStressTest::MultipleThreadsTest()
|
|||||||
// Make sure audio is OK after test has finished.
|
// Make sure audio is OK after test has finished.
|
||||||
|
|
||||||
// Call random API functions here and in extra thread, ignore any error
|
// 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
|
// This part should be equal to the marked part in the extra thread
|
||||||
// --- BEGIN ---
|
// --- BEGIN ---
|
||||||
rnd = rand();
|
rnd = rand();
|
||||||
if (rnd < (RAND_MAX / 2))
|
if (rnd < (RAND_MAX / 2)) {
|
||||||
{
|
|
||||||
// Start playout
|
// Start playout
|
||||||
base->StartPlayout(0);
|
base->StartPlayout(0);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Stop playout
|
// Stop playout
|
||||||
base->StopPlayout(0);
|
base->StopPlayout(0);
|
||||||
}
|
}
|
||||||
// --- END ---
|
// --- END ---
|
||||||
|
|
||||||
if (!(i % markInterval)) MARK();
|
if (!(i % markInterval))
|
||||||
|
MARK();
|
||||||
SLEEP(loopSleep);
|
SLEEP(loopSleep);
|
||||||
}
|
}
|
||||||
ANL();
|
ANL();
|
||||||
@ -416,16 +384,13 @@ int VoEStressTest::MultipleThreadsTest()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Thread functions
|
// Thread functions
|
||||||
|
|
||||||
bool VoEStressTest::RunExtraApi(void* ptr)
|
bool VoEStressTest::RunExtraApi(void* ptr) {
|
||||||
{
|
|
||||||
return static_cast<VoEStressTest*> (ptr)->ProcessExtraApi();
|
return static_cast<VoEStressTest*> (ptr)->ProcessExtraApi();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VoEStressTest::ProcessExtraApi()
|
bool VoEStressTest::ProcessExtraApi() {
|
||||||
{
|
|
||||||
// Prepare
|
// Prepare
|
||||||
VoEBase* base = _mgr.BasePtr();
|
VoEBase* base = _mgr.BasePtr();
|
||||||
int rnd(0);
|
int rnd(0);
|
||||||
@ -435,13 +400,10 @@ bool VoEStressTest::ProcessExtraApi()
|
|||||||
// This part should be equal to the marked part in the main thread
|
// This part should be equal to the marked part in the main thread
|
||||||
// --- BEGIN ---
|
// --- BEGIN ---
|
||||||
rnd = rand();
|
rnd = rand();
|
||||||
if (rnd < (RAND_MAX / 2))
|
if (rnd < (RAND_MAX / 2)) {
|
||||||
{
|
|
||||||
// Start playout
|
// Start playout
|
||||||
base->StartPlayout(0);
|
base->StartPlayout(0);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Stop playout
|
// Stop playout
|
||||||
base->StopPlayout(0);
|
base->StopPlayout(0);
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,13 @@ using namespace webrtc;
|
|||||||
|
|
||||||
class VoETestManager;
|
class VoETestManager;
|
||||||
|
|
||||||
class VoEStressTest
|
class VoEStressTest {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
VoEStressTest(VoETestManager& mgr) : _mgr(mgr), _ptrExtraApiThread(NULL) {};
|
VoEStressTest(VoETestManager& mgr) :
|
||||||
~VoEStressTest() {};
|
_mgr(mgr), _ptrExtraApiThread(NULL) {
|
||||||
|
}
|
||||||
|
~VoEStressTest() {
|
||||||
|
}
|
||||||
int DoTest();
|
int DoTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -110,7 +110,6 @@
|
|||||||
#define MARK() TEST_LOG("."); fflush(NULL); // Add test marker
|
#define MARK() TEST_LOG("."); fflush(NULL); // Add test marker
|
||||||
#define ANL() TEST_LOG("\n") // Add New Line
|
#define ANL() TEST_LOG("\n") // Add New Line
|
||||||
#define AOK() TEST_LOG("[Test is OK]"); fflush(NULL); // Add OK
|
#define AOK() TEST_LOG("[Test is OK]"); fflush(NULL); // Add OK
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define PAUSE \
|
#define PAUSE \
|
||||||
{ \
|
{ \
|
||||||
@ -146,8 +145,8 @@
|
|||||||
if (err != code) \
|
if (err != code) \
|
||||||
{ \
|
{ \
|
||||||
TEST_LOG_ERROR("Invalid error code (%d, should be %d) at line %d\n",
|
TEST_LOG_ERROR("Invalid error code (%d, should be %d) at line %d\n",
|
||||||
code, err, __LINE__); \
|
code, err, __LINE__);
|
||||||
} \
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define ASSERT_TRUE(expr) TEST_MUSTPASS(!(expr))
|
#define ASSERT_TRUE(expr) TEST_MUSTPASS(!(expr))
|
||||||
@ -174,7 +173,6 @@
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#endif // #ifdef _INSTRUMENTATION_TESTING_
|
#endif // #ifdef _INSTRUMENTATION_TESTING_
|
||||||
|
|
||||||
#define EXCLUDE() \
|
#define EXCLUDE() \
|
||||||
{ \
|
{ \
|
||||||
TEST_LOG("\n>>> Excluding test at line: %i <<<\n\n",__LINE__); \
|
TEST_LOG("\n>>> Excluding test at line: %i <<<\n\n",__LINE__); \
|
||||||
|
@ -29,19 +29,12 @@ namespace voetest {
|
|||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
// TestType enumerator
|
// TestType enumerator
|
||||||
enum TestType
|
enum TestType {
|
||||||
{
|
Invalid = -1, Standard = 0, Extended = 1, Stress = 2, Unit = 3, CPU = 4
|
||||||
Invalid = -1,
|
|
||||||
Standard = 0,
|
|
||||||
Extended = 1,
|
|
||||||
Stress = 2,
|
|
||||||
Unit = 3,
|
|
||||||
CPU = 4
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ExtendedSelection enumerator
|
// ExtendedSelection enumerator
|
||||||
enum ExtendedSelection
|
enum ExtendedSelection {
|
||||||
{
|
|
||||||
XSEL_Invalid = -1,
|
XSEL_Invalid = -1,
|
||||||
XSEL_None = 0,
|
XSEL_None = 0,
|
||||||
XSEL_All,
|
XSEL_All,
|
||||||
@ -66,8 +59,7 @@ enum ExtendedSelection
|
|||||||
// External transport (Transport)
|
// External transport (Transport)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class my_transportation : public Transport
|
class my_transportation : public Transport {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
my_transportation(VoENetwork* ptr);
|
my_transportation(VoENetwork* ptr);
|
||||||
virtual ~my_transportation();
|
virtual ~my_transportation();
|
||||||
|
@ -57,7 +57,7 @@ const char* VoEUnitTest::_key = "====YUtFWRAAAAADBtIHgAAAAAEAAAAcAAAAAQBHU0dsb2"
|
|||||||
// - G.729
|
// - G.729
|
||||||
// - G.722.1C
|
// - 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;
|
const int dTBetweenEachTest = 4000;
|
||||||
|
|
||||||
@ -65,23 +65,17 @@ const int dTBetweenEachTest = 4000;
|
|||||||
// Encrypt
|
// Encrypt
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void VoEUnitTest::encrypt(int channel_no,
|
void VoEUnitTest::encrypt(int channel_no, unsigned char * in_data,
|
||||||
unsigned char * in_data,
|
unsigned char * out_data, int bytes_in,
|
||||||
unsigned char * out_data,
|
int * bytes_out) {
|
||||||
int bytes_in,
|
|
||||||
int * bytes_out)
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!_extOnOff)
|
if (!_extOnOff) {
|
||||||
{
|
|
||||||
// no stereo emulation <=> pure bypass
|
// no stereo emulation <=> pure bypass
|
||||||
for (i = 0; i < bytes_in; i++)
|
for (i = 0; i < bytes_in; i++)
|
||||||
out_data[i] = in_data[i];
|
out_data[i] = in_data[i];
|
||||||
*bytes_out = bytes_in;
|
*bytes_out = bytes_in;
|
||||||
}
|
} else if (_extOnOff && (_extBitsPerSample == 16)) {
|
||||||
else if (_extOnOff && (_extBitsPerSample == 16))
|
|
||||||
{
|
|
||||||
// stereo emulation (sample based, 2 bytes per sample)
|
// stereo emulation (sample based, 2 bytes per sample)
|
||||||
|
|
||||||
const int nBytesPayload = bytes_in - 12;
|
const int nBytesPayload = bytes_in - 12;
|
||||||
@ -94,8 +88,7 @@ void VoEUnitTest::encrypt(int channel_no,
|
|||||||
short* ptrOut = (short*) &out_data[12];
|
short* ptrOut = (short*) &out_data[12];
|
||||||
|
|
||||||
// network byte order
|
// 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
|
// produce two output samples for each input sample
|
||||||
*ptrOut++ = *ptrIn; // left sample
|
*ptrOut++ = *ptrIn; // left sample
|
||||||
*ptrOut++ = *ptrIn; // right sample
|
*ptrOut++ = *ptrIn; // right sample
|
||||||
@ -103,9 +96,7 @@ void VoEUnitTest::encrypt(int channel_no,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*bytes_out = 12 + 2 * nBytesPayload;
|
*bytes_out = 12 + 2 * nBytesPayload;
|
||||||
}
|
} else if (_extOnOff && (_extBitsPerSample == 8)) {
|
||||||
else if (_extOnOff && (_extBitsPerSample == 8))
|
|
||||||
{
|
|
||||||
// stereo emulation (sample based, 1 bytes per sample)
|
// stereo emulation (sample based, 1 bytes per sample)
|
||||||
|
|
||||||
const int nBytesPayload = bytes_in - 12;
|
const int nBytesPayload = bytes_in - 12;
|
||||||
@ -118,8 +109,7 @@ void VoEUnitTest::encrypt(int channel_no,
|
|||||||
unsigned char* ptrOut = (unsigned char*) &out_data[12];
|
unsigned char* ptrOut = (unsigned char*) &out_data[12];
|
||||||
|
|
||||||
// network byte order
|
// network byte order
|
||||||
for (i = 0; i < nBytesPayload; i++)
|
for (i = 0; i < nBytesPayload; i++) {
|
||||||
{
|
|
||||||
// produce two output samples for each input sample
|
// produce two output samples for each input sample
|
||||||
*ptrOut++ = *ptrIn; // left sample
|
*ptrOut++ = *ptrIn; // left sample
|
||||||
*ptrOut++ = *ptrIn; // right sample
|
*ptrOut++ = *ptrIn; // right sample
|
||||||
@ -127,9 +117,7 @@ void VoEUnitTest::encrypt(int channel_no,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*bytes_out = 12 + 2 * nBytesPayload;
|
*bytes_out = 12 + 2 * nBytesPayload;
|
||||||
}
|
} else if (_extOnOff && (_extBitsPerSample == -1)) {
|
||||||
else if (_extOnOff && (_extBitsPerSample == -1))
|
|
||||||
{
|
|
||||||
// stereo emulation (frame based)
|
// stereo emulation (frame based)
|
||||||
|
|
||||||
const int nBytesPayload = bytes_in - 12;
|
const int nBytesPayload = bytes_in - 12;
|
||||||
@ -142,16 +130,14 @@ void VoEUnitTest::encrypt(int channel_no,
|
|||||||
unsigned char* ptrOut = (unsigned char*) &out_data[12];
|
unsigned char* ptrOut = (unsigned char*) &out_data[12];
|
||||||
|
|
||||||
// left channel
|
// left channel
|
||||||
for (i = 0; i < nBytesPayload; i++)
|
for (i = 0; i < nBytesPayload; i++) {
|
||||||
{
|
|
||||||
*ptrOut++ = *ptrIn++;
|
*ptrOut++ = *ptrIn++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrIn = (unsigned char*) &in_data[12];
|
ptrIn = (unsigned char*) &in_data[12];
|
||||||
|
|
||||||
// right channel
|
// right channel
|
||||||
for (i = 0; i < nBytesPayload; i++)
|
for (i = 0; i < nBytesPayload; i++) {
|
||||||
{
|
|
||||||
*ptrOut++ = *ptrIn++;
|
*ptrOut++ = *ptrIn++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,46 +145,35 @@ void VoEUnitTest::encrypt(int channel_no,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoEUnitTest::decrypt(int channel_no,
|
void VoEUnitTest::decrypt(int channel_no, unsigned char * in_data,
|
||||||
unsigned char * in_data,
|
unsigned char * out_data, int bytes_in,
|
||||||
unsigned char * out_data,
|
int * bytes_out) {
|
||||||
int bytes_in,
|
|
||||||
int * bytes_out)
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < bytes_in; i++)
|
for (i = 0; i < bytes_in; i++)
|
||||||
out_data[i] = in_data[i];
|
out_data[i] = in_data[i];
|
||||||
*bytes_out = bytes_in;
|
*bytes_out = bytes_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoEUnitTest::encrypt_rtcp(int channel_no,
|
void VoEUnitTest::encrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||||
unsigned char * in_data,
|
unsigned char * out_data, int bytes_in,
|
||||||
unsigned char * out_data,
|
int * bytes_out) {
|
||||||
int bytes_in,
|
|
||||||
int * bytes_out)
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < bytes_in; i++)
|
for (i = 0; i < bytes_in; i++)
|
||||||
out_data[i] = in_data[i];
|
out_data[i] = in_data[i];
|
||||||
*bytes_out = bytes_in;
|
*bytes_out = bytes_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoEUnitTest::decrypt_rtcp(int channel_no,
|
void VoEUnitTest::decrypt_rtcp(int channel_no, unsigned char * in_data,
|
||||||
unsigned char * in_data,
|
unsigned char * out_data, int bytes_in,
|
||||||
unsigned char * out_data,
|
int * bytes_out) {
|
||||||
int bytes_in,
|
|
||||||
int * bytes_out)
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < bytes_in; i++)
|
for (i = 0; i < bytes_in; i++)
|
||||||
out_data[i] = in_data[i];
|
out_data[i] = in_data[i];
|
||||||
*bytes_out = bytes_in;
|
*bytes_out = bytes_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoEUnitTest::SetStereoExternalEncryption(int channel,
|
void VoEUnitTest::SetStereoExternalEncryption(int channel, bool onOff,
|
||||||
bool onOff,
|
int bitsPerSample) {
|
||||||
int bitsPerSample)
|
|
||||||
{
|
|
||||||
_extOnOff = onOff;
|
_extOnOff = onOff;
|
||||||
_extChannel = channel;
|
_extChannel = channel;
|
||||||
_extBitsPerSample = bitsPerSample;
|
_extBitsPerSample = bitsPerSample;
|
||||||
@ -212,12 +187,8 @@ MyMedia mpobj;
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
VoEUnitTest::VoEUnitTest(VoETestManager& mgr) :
|
VoEUnitTest::VoEUnitTest(VoETestManager& mgr) :
|
||||||
_mgr(mgr),
|
_mgr(mgr), _extOnOff(false), _extBitsPerSample(-1) {
|
||||||
_extOnOff(false),
|
for (int i = 0; i < 32; i++) {
|
||||||
_extBitsPerSample(-1)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 32; i++)
|
|
||||||
{
|
|
||||||
_listening[i] = false;
|
_listening[i] = false;
|
||||||
_playing[i] = false;
|
_playing[i] = false;
|
||||||
_sending[i] = false;
|
_sending[i] = false;
|
||||||
@ -228,15 +199,12 @@ VoEUnitTest::VoEUnitTest(VoETestManager& mgr) :
|
|||||||
// DoTest
|
// DoTest
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int VoEUnitTest::DoTest()
|
int VoEUnitTest::DoTest() {
|
||||||
{
|
|
||||||
int test(-1);
|
int test(-1);
|
||||||
int ret(0);
|
int ret(0);
|
||||||
while ((test != 0) && (ret != -1))
|
while ((test != 0) && (ret != -1)) {
|
||||||
{
|
|
||||||
test = MenuSelection();
|
test = MenuSelection();
|
||||||
switch (test)
|
switch (test) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
// Quit stress test
|
// Quit stress test
|
||||||
break;
|
break;
|
||||||
@ -260,8 +228,7 @@ int VoEUnitTest::DoTest()
|
|||||||
// MenuSelection
|
// MenuSelection
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int VoEUnitTest::MenuSelection()
|
int VoEUnitTest::MenuSelection() {
|
||||||
{
|
|
||||||
printf("------------------------------------------------\n");
|
printf("------------------------------------------------\n");
|
||||||
printf("Select unit test\n\n");
|
printf("Select unit test\n\n");
|
||||||
printf(" (0) Quit\n");
|
printf(" (0) Quit\n");
|
||||||
@ -272,12 +239,10 @@ int VoEUnitTest::MenuSelection()
|
|||||||
const int maxMenuSelection = 2;
|
const int maxMenuSelection = 2;
|
||||||
int selection(-1);
|
int selection(-1);
|
||||||
|
|
||||||
while ((selection < 0) || (selection > maxMenuSelection))
|
while ((selection < 0) || (selection > maxMenuSelection)) {
|
||||||
{
|
|
||||||
printf("\n: ");
|
printf("\n: ");
|
||||||
int retval = scanf("%d", &selection);
|
int retval = scanf("%d", &selection);
|
||||||
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection))
|
if ((retval != 1) || (selection < 0) || (selection > maxMenuSelection)) {
|
||||||
{
|
|
||||||
printf("Invalid selection!\n");
|
printf("Invalid selection!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,14 +254,8 @@ int VoEUnitTest::MenuSelection()
|
|||||||
// StartMedia
|
// StartMedia
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int VoEUnitTest::StartMedia(int channel,
|
int VoEUnitTest::StartMedia(int channel, int rtpPort, bool listen, bool playout,
|
||||||
int rtpPort,
|
bool send, bool fileAsMic, bool localFile) {
|
||||||
bool listen,
|
|
||||||
bool playout,
|
|
||||||
bool send,
|
|
||||||
bool fileAsMic,
|
|
||||||
bool localFile)
|
|
||||||
{
|
|
||||||
VoEBase* base = _mgr.BasePtr();
|
VoEBase* base = _mgr.BasePtr();
|
||||||
VoEFile* file = _mgr.FilePtr();
|
VoEFile* file = _mgr.FilePtr();
|
||||||
|
|
||||||
@ -306,31 +265,26 @@ int VoEUnitTest::StartMedia(int channel,
|
|||||||
|
|
||||||
CHECK(base->SetLocalReceiver(channel, rtpPort));
|
CHECK(base->SetLocalReceiver(channel, rtpPort));
|
||||||
CHECK(base->SetSendDestination(channel, rtpPort, "127.0.0.1"));
|
CHECK(base->SetSendDestination(channel, rtpPort, "127.0.0.1"));
|
||||||
if (listen)
|
if (listen) {
|
||||||
{
|
|
||||||
_listening[channel] = true;
|
_listening[channel] = true;
|
||||||
CHECK(base->StartReceive(channel));
|
CHECK(base->StartReceive(channel));
|
||||||
}
|
}
|
||||||
if (playout)
|
if (playout) {
|
||||||
{
|
|
||||||
_playing[channel] = true;
|
_playing[channel] = true;
|
||||||
CHECK(base->StartPlayout(channel));
|
CHECK(base->StartPlayout(channel));
|
||||||
}
|
}
|
||||||
if (send)
|
if (send) {
|
||||||
{
|
|
||||||
_sending[channel] = true;
|
_sending[channel] = true;
|
||||||
CHECK(base->StartSend(channel));
|
CHECK(base->StartSend(channel));
|
||||||
}
|
}
|
||||||
if (fileAsMic)
|
if (fileAsMic) {
|
||||||
{
|
|
||||||
// play mic as file, mix with microphone to ensure that SWB can be
|
// play mic as file, mix with microphone to ensure that SWB can be
|
||||||
//tested as well
|
//tested as well
|
||||||
const bool mixWithMic(true);
|
const bool mixWithMic(true);
|
||||||
CHECK(file->StartPlayingFileAsMicrophone(channel, _mgr.AudioFilename(),
|
CHECK(file->StartPlayingFileAsMicrophone(channel, _mgr.AudioFilename(),
|
||||||
true, mixWithMic));
|
true, mixWithMic));
|
||||||
}
|
}
|
||||||
if (localFile)
|
if (localFile) {
|
||||||
{
|
|
||||||
CHECK(file->StartPlayingFileLocally(channel,
|
CHECK(file->StartPlayingFileLocally(channel,
|
||||||
GetResource("audio_short16.pcm"),
|
GetResource("audio_short16.pcm"),
|
||||||
false,
|
false,
|
||||||
@ -344,31 +298,25 @@ int VoEUnitTest::StartMedia(int channel,
|
|||||||
// StopMedia
|
// StopMedia
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int VoEUnitTest::StopMedia(int channel)
|
int VoEUnitTest::StopMedia(int channel) {
|
||||||
{
|
|
||||||
VoEBase* base = _mgr.BasePtr();
|
VoEBase* base = _mgr.BasePtr();
|
||||||
VoEFile* file = _mgr.FilePtr();
|
VoEFile* file = _mgr.FilePtr();
|
||||||
|
|
||||||
if (file->IsPlayingFileAsMicrophone(channel))
|
if (file->IsPlayingFileAsMicrophone(channel)) {
|
||||||
{
|
|
||||||
CHECK(file->StopPlayingFileAsMicrophone(channel));
|
CHECK(file->StopPlayingFileAsMicrophone(channel));
|
||||||
}
|
}
|
||||||
if (file->IsPlayingFileLocally(channel))
|
if (file->IsPlayingFileLocally(channel)) {
|
||||||
{
|
|
||||||
CHECK(file->StopPlayingFileLocally(channel));
|
CHECK(file->StopPlayingFileLocally(channel));
|
||||||
}
|
}
|
||||||
if (_listening[channel])
|
if (_listening[channel]) {
|
||||||
{
|
|
||||||
_listening[channel] = false;
|
_listening[channel] = false;
|
||||||
CHECK(base->StopReceive(channel));
|
CHECK(base->StopReceive(channel));
|
||||||
}
|
}
|
||||||
if (_playing[channel])
|
if (_playing[channel]) {
|
||||||
{
|
|
||||||
_playing[channel] = false;
|
_playing[channel] = false;
|
||||||
CHECK(base->StopPlayout(channel));
|
CHECK(base->StopPlayout(channel));
|
||||||
}
|
}
|
||||||
if (_sending[channel])
|
if (_sending[channel]) {
|
||||||
{
|
|
||||||
_sending[channel] = false;
|
_sending[channel] = false;
|
||||||
CHECK(base->StopSend(channel));
|
CHECK(base->StopSend(channel));
|
||||||
}
|
}
|
||||||
@ -376,10 +324,8 @@ int VoEUnitTest::StopMedia(int channel)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoEUnitTest::Sleep(unsigned int timeMillisec, bool addMarker)
|
void VoEUnitTest::Sleep(unsigned int timeMillisec, bool addMarker) {
|
||||||
{
|
if (addMarker) {
|
||||||
if (addMarker)
|
|
||||||
{
|
|
||||||
float dtSec = (float) ((float) timeMillisec / 1000.0);
|
float dtSec = (float) ((float) timeMillisec / 1000.0);
|
||||||
printf("[dT=%.1f]", dtSec);
|
printf("[dT=%.1f]", dtSec);
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
@ -387,22 +333,21 @@ void VoEUnitTest::Sleep(unsigned int timeMillisec, bool addMarker)
|
|||||||
::Sleep(timeMillisec);
|
::Sleep(timeMillisec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoEUnitTest::Wait()
|
void VoEUnitTest::Wait() {
|
||||||
{
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
printf("\npress any key..."); fflush(NULL);
|
printf("\npress any key..."); fflush(NULL);
|
||||||
_getch();
|
_getch();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoEUnitTest::Test(const char* msg)
|
void VoEUnitTest::Test(const char* msg) {
|
||||||
{
|
printf("%s", msg);
|
||||||
printf("%s", msg); fflush(NULL);
|
fflush(NULL);
|
||||||
printf("\n"); fflush(NULL);
|
printf("\n");
|
||||||
|
fflush(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEUnitTest::MixerTest()
|
int VoEUnitTest::MixerTest() {
|
||||||
{
|
|
||||||
// Set up test parameters first
|
// Set up test parameters first
|
||||||
//
|
//
|
||||||
const int testTime(dTBetweenEachTest);
|
const int testTime(dTBetweenEachTest);
|
||||||
@ -424,12 +369,8 @@ int VoEUnitTest::MixerTest()
|
|||||||
// Set trace
|
// Set trace
|
||||||
//
|
//
|
||||||
VoiceEngine::SetTraceFile(GetFilename("UnitTest_Mixer_trace.txt"));
|
VoiceEngine::SetTraceFile(GetFilename("UnitTest_Mixer_trace.txt"));
|
||||||
VoiceEngine::SetTraceFilter(kTraceStateInfo |
|
VoiceEngine::SetTraceFilter(kTraceStateInfo | kTraceWarning | kTraceError |
|
||||||
kTraceWarning |
|
kTraceCritical | kTraceApiCall | kTraceMemory |
|
||||||
kTraceError |
|
|
||||||
kTraceCritical |
|
|
||||||
kTraceApiCall |
|
|
||||||
kTraceMemory |
|
|
||||||
kTraceInfo);
|
kTraceInfo);
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
@ -928,8 +869,7 @@ int VoEUnitTest::MixerTest()
|
|||||||
|
|
||||||
base->CreateChannel();
|
base->CreateChannel();
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++) {
|
||||||
{
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
Test("Dtmf direct feedback is now enabled...");
|
Test("Dtmf direct feedback is now enabled...");
|
||||||
else
|
else
|
||||||
@ -1131,7 +1071,6 @@ int VoEUnitTest::MixerTest()
|
|||||||
base->DeleteChannel(0);
|
base->DeleteChannel(0);
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
CHECK(base->Terminate());
|
CHECK(base->Terminate());
|
||||||
|
|
||||||
printf("\n\n------------------------------------------------\n");
|
printf("\n\n------------------------------------------------\n");
|
||||||
|
@ -17,11 +17,10 @@ namespace voetest {
|
|||||||
|
|
||||||
class VoETestManager;
|
class VoETestManager;
|
||||||
|
|
||||||
class VoEUnitTest : public Encryption
|
class VoEUnitTest : public Encryption {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
VoEUnitTest(VoETestManager& mgr);
|
VoEUnitTest(VoETestManager& mgr);
|
||||||
~VoEUnitTest() {};
|
~VoEUnitTest() {}
|
||||||
int DoTest();
|
int DoTest();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -40,13 +39,16 @@ private:
|
|||||||
int MixerTest();
|
int MixerTest();
|
||||||
void Sleep(unsigned int timeMillisec, bool addMarker = false);
|
void Sleep(unsigned int timeMillisec, bool addMarker = false);
|
||||||
void Wait();
|
void Wait();
|
||||||
int StartMedia(int channel, int rtpPort, bool listen, bool playout,
|
int StartMedia(int channel,
|
||||||
bool send, bool fileAsMic, bool localFile);
|
int rtpPort,
|
||||||
|
bool listen,
|
||||||
|
bool playout,
|
||||||
|
bool send,
|
||||||
|
bool fileAsMic,
|
||||||
|
bool localFile);
|
||||||
int StopMedia(int channel);
|
int StopMedia(int channel);
|
||||||
void Test(const char* msg);
|
void Test(const char* msg);
|
||||||
void SetStereoExternalEncryption(int channel,
|
void SetStereoExternalEncryption(int channel, bool onOff, int bitsPerSample);
|
||||||
bool onOff,
|
|
||||||
int bitsPerSample);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VoETestManager& _mgr;
|
VoETestManager& _mgr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user