Move the VoE tests to use external transport instead of the built in udp transport
Review URL: https://webrtc-codereview.appspot.com/1223006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3708 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
e86f43b02a
commit
e30823911c
@ -15,17 +15,20 @@
|
|||||||
#include "gflags/gflags.h"
|
#include "gflags/gflags.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include "voice_engine/include/voe_audio_processing.h"
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
#include "voice_engine/include/voe_base.h"
|
#include "webrtc/test/channel_transport/include/channel_transport.h"
|
||||||
#include "voice_engine/include/voe_codec.h"
|
#include "webrtc/voice_engine/include/voe_audio_processing.h"
|
||||||
#include "voice_engine/include/voe_hardware.h"
|
#include "webrtc/voice_engine/include/voe_base.h"
|
||||||
|
#include "webrtc/voice_engine/include/voe_codec.h"
|
||||||
|
#include "webrtc/voice_engine/include/voe_hardware.h"
|
||||||
|
#include "webrtc/voice_engine/include/voe_network.h"
|
||||||
|
|
||||||
DEFINE_string(render, "render", "render device name");
|
DEFINE_string(render, "render", "render device name");
|
||||||
DEFINE_string(codec, "ISAC", "codec name");
|
DEFINE_string(codec, "ISAC", "codec name");
|
||||||
DEFINE_int32(rate, 16000, "codec sample rate in Hz");
|
DEFINE_int32(rate, 16000, "codec sample rate in Hz");
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace {
|
namespace test {
|
||||||
|
|
||||||
void RunHarness() {
|
void RunHarness() {
|
||||||
VoiceEngine* voe = VoiceEngine::Create();
|
VoiceEngine* voe = VoiceEngine::Create();
|
||||||
@ -38,12 +41,18 @@ void RunHarness() {
|
|||||||
ASSERT_TRUE(codec != NULL);
|
ASSERT_TRUE(codec != NULL);
|
||||||
VoEHardware* hardware = VoEHardware::GetInterface(voe);
|
VoEHardware* hardware = VoEHardware::GetInterface(voe);
|
||||||
ASSERT_TRUE(hardware != NULL);
|
ASSERT_TRUE(hardware != NULL);
|
||||||
|
VoENetwork* network = VoENetwork::GetInterface(voe);
|
||||||
|
ASSERT_TRUE(network != NULL);
|
||||||
|
|
||||||
ASSERT_EQ(0, base->Init());
|
ASSERT_EQ(0, base->Init());
|
||||||
int channel = base->CreateChannel();
|
int channel = base->CreateChannel();
|
||||||
ASSERT_NE(-1, channel);
|
ASSERT_NE(-1, channel);
|
||||||
ASSERT_EQ(0, base->SetSendDestination(channel, 1234, "127.0.0.1"));
|
|
||||||
ASSERT_EQ(0, base->SetLocalReceiver(channel, 1234));
|
scoped_ptr<VoiceChannelTransport> voice_channel_transport(
|
||||||
|
new VoiceChannelTransport(network, channel));
|
||||||
|
|
||||||
|
ASSERT_EQ(0, voice_channel_transport->SetSendDestination("127.0.0.1", 1234));
|
||||||
|
ASSERT_EQ(0, voice_channel_transport->SetLocalReceiver(1234));
|
||||||
|
|
||||||
CodecInst codec_params = {0};
|
CodecInst codec_params = {0};
|
||||||
bool codec_found = false;
|
bool codec_found = false;
|
||||||
@ -90,10 +99,10 @@ void RunHarness() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace test
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||||
webrtc::RunHarness();
|
webrtc::test::RunHarness();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
'target_name': 'audio_e2e_harness',
|
'target_name': 'audio_e2e_harness',
|
||||||
'type': 'executable',
|
'type': 'executable',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
|
'<(webrtc_root)/test/channel_transport.gyp:channel_transport',
|
||||||
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine_core',
|
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine_core',
|
||||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||||
'<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags',
|
'<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags',
|
||||||
|
@ -13,9 +13,30 @@
|
|||||||
|
|
||||||
#include "before_initialization_fixture.h"
|
#include "before_initialization_fixture.h"
|
||||||
#include "scoped_ptr.h"
|
#include "scoped_ptr.h"
|
||||||
|
#include "webrtc/common_types.h"
|
||||||
|
|
||||||
class TestErrorObserver;
|
class TestErrorObserver;
|
||||||
|
|
||||||
|
class LoopBackTransport : public webrtc::Transport {
|
||||||
|
public:
|
||||||
|
LoopBackTransport(webrtc::VoENetwork* voe_network)
|
||||||
|
: voe_network_(voe_network) {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int SendPacket(int channel, const void *data, int len) {
|
||||||
|
voe_network_->ReceivedRTPPacket(channel, data, len);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int SendRTCPPacket(int channel, const void *data, int len) {
|
||||||
|
voe_network_->ReceivedRTCPPacket(channel, data, len);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
webrtc::VoENetwork* voe_network_;
|
||||||
|
};
|
||||||
|
|
||||||
// This fixture initializes the voice engine in addition to the work
|
// This fixture initializes the voice engine in addition to the work
|
||||||
// done by the before-initialization fixture. It also registers an error
|
// done by the before-initialization fixture. It also registers an error
|
||||||
// observer which will fail tests on error callbacks. This fixture is
|
// observer which will fail tests on error callbacks. This fixture is
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
static const char* kLoopbackIp = "127.0.0.1";
|
|
||||||
|
|
||||||
AfterStreamingFixture::AfterStreamingFixture()
|
AfterStreamingFixture::AfterStreamingFixture()
|
||||||
: channel_(voe_base_->CreateChannel()) {
|
: channel_(voe_base_->CreateChannel()) {
|
||||||
EXPECT_GE(channel_, 0);
|
EXPECT_GE(channel_, 0);
|
||||||
@ -30,7 +28,9 @@ AfterStreamingFixture::~AfterStreamingFixture() {
|
|||||||
voe_file_->StopPlayingFileAsMicrophone(channel_);
|
voe_file_->StopPlayingFileAsMicrophone(channel_);
|
||||||
PausePlaying();
|
PausePlaying();
|
||||||
|
|
||||||
|
EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(channel_));
|
||||||
voe_base_->DeleteChannel(channel_);
|
voe_base_->DeleteChannel(channel_);
|
||||||
|
delete transport_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AfterStreamingFixture::SwitchToManualMicrophone() {
|
void AfterStreamingFixture::SwitchToManualMicrophone() {
|
||||||
@ -59,8 +59,8 @@ void AfterStreamingFixture::ResumePlaying() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AfterStreamingFixture::SetUpLocalPlayback() {
|
void AfterStreamingFixture::SetUpLocalPlayback() {
|
||||||
EXPECT_EQ(0, voe_base_->SetSendDestination(channel_, 8000, kLoopbackIp));
|
transport_ = new LoopBackTransport(voe_network_);
|
||||||
EXPECT_EQ(0, voe_base_->SetLocalReceiver(0, 8000));
|
EXPECT_EQ(0, voe_network_->RegisterExternalTransport(channel_, *transport_));
|
||||||
|
|
||||||
webrtc::CodecInst codec;
|
webrtc::CodecInst codec;
|
||||||
codec.channels = 1;
|
codec.channels = 1;
|
||||||
|
@ -42,6 +42,8 @@ class AfterStreamingFixture : public AfterInitializationFixture {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void SetUpLocalPlayback();
|
void SetUpLocalPlayback();
|
||||||
|
|
||||||
|
LoopBackTransport* transport_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,79 +23,6 @@ class NetworkTest : public AfterStreamingFixture {
|
|||||||
|
|
||||||
using ::testing::Between;
|
using ::testing::Between;
|
||||||
|
|
||||||
TEST_F(NetworkTest, GetSourceInfoReturnsPortsAndIpAfterReceivingPackets) {
|
|
||||||
// Give some time to send speech packets.
|
|
||||||
Sleep(200);
|
|
||||||
|
|
||||||
int rtp_port = 0;
|
|
||||||
int rtcp_port = 0;
|
|
||||||
char source_ip[32] = "127.0.0.1";
|
|
||||||
|
|
||||||
EXPECT_EQ(0, voe_network_->GetSourceInfo(channel_, rtp_port, rtcp_port,
|
|
||||||
source_ip));
|
|
||||||
|
|
||||||
EXPECT_EQ(kDefaultRtpPort, rtp_port);
|
|
||||||
EXPECT_EQ(kDefaultRtcpPort, rtcp_port);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(NetworkTest, NoFilterIsEnabledByDefault) {
|
|
||||||
int filter_rtp_port = -1;
|
|
||||||
int filter_rtcp_port = -1;
|
|
||||||
char filter_ip[64] = { 0 };
|
|
||||||
|
|
||||||
EXPECT_EQ(0, voe_network_->GetSourceFilter(
|
|
||||||
channel_, filter_rtp_port, filter_rtcp_port, filter_ip));
|
|
||||||
|
|
||||||
EXPECT_EQ(0, filter_rtp_port);
|
|
||||||
EXPECT_EQ(0, filter_rtcp_port);
|
|
||||||
EXPECT_STREQ("", filter_ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(NetworkTest, ManualCanFilterRtpPort) {
|
|
||||||
TEST_LOG("No filter, should hear audio.\n");
|
|
||||||
Sleep(1000);
|
|
||||||
|
|
||||||
int port_to_block = kDefaultRtpPort + 10;
|
|
||||||
EXPECT_EQ(0, voe_network_->SetSourceFilter(channel_, port_to_block));
|
|
||||||
|
|
||||||
// Changes should take effect immediately.
|
|
||||||
int filter_rtp_port = -1;
|
|
||||||
int filter_rtcp_port = -1;
|
|
||||||
char filter_ip[64] = { 0 };
|
|
||||||
|
|
||||||
EXPECT_EQ(0, voe_network_->GetSourceFilter(
|
|
||||||
channel_, filter_rtp_port, filter_rtcp_port, filter_ip));
|
|
||||||
|
|
||||||
EXPECT_EQ(port_to_block, filter_rtp_port);
|
|
||||||
|
|
||||||
TEST_LOG("Now filtering port %d, should not hear audio.\n", port_to_block);
|
|
||||||
Sleep(1000);
|
|
||||||
|
|
||||||
TEST_LOG("Removing filter, should hear audio.\n");
|
|
||||||
EXPECT_EQ(0, voe_network_->SetSourceFilter(channel_, 0));
|
|
||||||
Sleep(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(NetworkTest, ManualCanFilterIp) {
|
|
||||||
TEST_LOG("You should hear audio.\n");
|
|
||||||
Sleep(1000);
|
|
||||||
|
|
||||||
int rtcp_port_to_block = kDefaultRtcpPort + 10;
|
|
||||||
TEST_LOG("Filtering IP 10.10.10.10, should not hear audio.\n");
|
|
||||||
EXPECT_EQ(0, voe_network_->SetSourceFilter(
|
|
||||||
channel_, 0, rtcp_port_to_block, "10.10.10.10"));
|
|
||||||
|
|
||||||
int filter_rtp_port = -1;
|
|
||||||
int filter_rtcp_port = -1;
|
|
||||||
char filter_ip[64] = { 0 };
|
|
||||||
EXPECT_EQ(0, voe_network_->GetSourceFilter(
|
|
||||||
channel_, filter_rtp_port, filter_rtcp_port, filter_ip));
|
|
||||||
|
|
||||||
EXPECT_EQ(0, filter_rtp_port);
|
|
||||||
EXPECT_EQ(rtcp_port_to_block, filter_rtcp_port);
|
|
||||||
EXPECT_STREQ("10.10.10.10", filter_ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(NetworkTest,
|
TEST_F(NetworkTest,
|
||||||
CallsObserverOnTimeoutAndRestartWhenPacketTimeoutNotificationIsEnabled) {
|
CallsObserverOnTimeoutAndRestartWhenPacketTimeoutNotificationIsEnabled) {
|
||||||
// First, get rid of the default, asserting observer and install our observer.
|
// First, get rid of the default, asserting observer and install our observer.
|
||||||
|
@ -101,10 +101,10 @@ class RtpRtcpTest : public AfterStreamingFixture {
|
|||||||
second_channel_ = voe_base_->CreateChannel();
|
second_channel_ = voe_base_->CreateChannel();
|
||||||
EXPECT_GE(second_channel_, 0);
|
EXPECT_GE(second_channel_, 0);
|
||||||
|
|
||||||
EXPECT_EQ(0, voe_base_->SetSendDestination(
|
transport_ = new LoopBackTransport(voe_network_);
|
||||||
second_channel_, 8002, "127.0.0.1"));
|
EXPECT_EQ(0, voe_network_->RegisterExternalTransport(second_channel_,
|
||||||
EXPECT_EQ(0, voe_base_->SetLocalReceiver(
|
*transport_));
|
||||||
second_channel_, 8002));
|
|
||||||
EXPECT_EQ(0, voe_base_->StartReceive(second_channel_));
|
EXPECT_EQ(0, voe_base_->StartReceive(second_channel_));
|
||||||
EXPECT_EQ(0, voe_base_->StartPlayout(second_channel_));
|
EXPECT_EQ(0, voe_base_->StartPlayout(second_channel_));
|
||||||
EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC(second_channel_, 5678));
|
EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC(second_channel_, 5678));
|
||||||
@ -115,10 +115,13 @@ class RtpRtcpTest : public AfterStreamingFixture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() {
|
void TearDown() {
|
||||||
|
EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(second_channel_));
|
||||||
voe_base_->DeleteChannel(second_channel_);
|
voe_base_->DeleteChannel(second_channel_);
|
||||||
|
delete transport_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int second_channel_;
|
int second_channel_;
|
||||||
|
LoopBackTransport* transport_;
|
||||||
};
|
};
|
||||||
|
|
||||||
void RtcpAppHandler::OnApplicationDataReceived(
|
void RtcpAppHandler::OnApplicationDataReceived(
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "voe_cpu_test.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -16,9 +18,11 @@
|
|||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "voe_cpu_test.h"
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
|
#include "webrtc/test/channel_transport/include/channel_transport.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
using namespace test;
|
||||||
|
|
||||||
namespace voetest {
|
namespace voetest {
|
||||||
|
|
||||||
@ -45,6 +49,7 @@ int VoECpuTest::DoTest() {
|
|||||||
VoEFile* file = _mgr.FilePtr();
|
VoEFile* file = _mgr.FilePtr();
|
||||||
VoECodec* codec = _mgr.CodecPtr();
|
VoECodec* codec = _mgr.CodecPtr();
|
||||||
VoEAudioProcessing* apm = _mgr.APMPtr();
|
VoEAudioProcessing* apm = _mgr.APMPtr();
|
||||||
|
VoENetwork* voe_network = _mgr.NetworkPtr();
|
||||||
|
|
||||||
int channel(-1);
|
int channel(-1);
|
||||||
CodecInst isac;
|
CodecInst isac;
|
||||||
@ -59,8 +64,12 @@ int VoECpuTest::DoTest() {
|
|||||||
CHECK(base->Init());
|
CHECK(base->Init());
|
||||||
channel = base->CreateChannel();
|
channel = base->CreateChannel();
|
||||||
|
|
||||||
CHECK(base->SetLocalReceiver(channel, 5566));
|
scoped_ptr<VoiceChannelTransport> voice_socket_transport(
|
||||||
CHECK(base->SetSendDestination(channel, 5566, "127.0.0.1"));
|
new VoiceChannelTransport(voe_network, channel));
|
||||||
|
|
||||||
|
CHECK(voice_socket_transport->SetSendDestination("127.0.0.1", 5566));
|
||||||
|
CHECK(voice_socket_transport->SetLocalReceiver(5566));
|
||||||
|
|
||||||
CHECK(codec->SetRecPayloadType(channel, isac));
|
CHECK(codec->SetRecPayloadType(channel, isac));
|
||||||
CHECK(codec->SetSendCodec(channel, isac));
|
CHECK(codec->SetSendCodec(channel, isac));
|
||||||
|
|
||||||
@ -86,7 +95,6 @@ int VoECpuTest::DoTest() {
|
|||||||
|
|
||||||
base->DeleteChannel(channel);
|
base->DeleteChannel(channel);
|
||||||
CHECK(base->Terminate());
|
CHECK(base->Terminate());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,14 @@
|
|||||||
#define WEBRTC_VOICE_ENGINE_VOE_EXTENDED_TEST_H
|
#define WEBRTC_VOICE_ENGINE_VOE_EXTENDED_TEST_H
|
||||||
|
|
||||||
#include "voe_standard_test.h"
|
#include "voe_standard_test.h"
|
||||||
#include "modules/audio_device/include/audio_device.h"
|
#include "webrtc/modules/audio_device/include/audio_device.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/ref_count.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/sleep.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
|
#include "webrtc/test/channel_transport/include/channel_transport.h"
|
||||||
|
|
||||||
namespace voetest {
|
namespace voetest {
|
||||||
|
|
||||||
@ -425,35 +432,39 @@ class VoEExtendedTest : public VoiceEngineObserver,
|
|||||||
int TestRTP_RTCP();
|
int TestRTP_RTCP();
|
||||||
int TestVideoSync();
|
int TestVideoSync();
|
||||||
int TestVolumeControl();
|
int TestVolumeControl();
|
||||||
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, const char* message, const int length);
|
void CallbackOnTrace(const TraceLevel level, const char* message,
|
||||||
protected:
|
const int length);
|
||||||
|
|
||||||
// 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, unsigned int timeMillisec, bool addFileAsMicrophone = false,
|
void Play(int channel, unsigned int timeMillisec,
|
||||||
bool addTimeMarker = false);
|
bool addFileAsMicrophone = false, bool addTimeMarker = false);
|
||||||
void Sleep(unsigned int timeMillisec, bool addMarker = 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);
|
void StopMedia(int channel);
|
||||||
int RunMixingTest(int num_remote_channels, int num_local_channels,
|
int RunMixingTest(int num_remote_channels, int num_local_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:
|
|
||||||
VoETestManager& _mgr;
|
VoETestManager& _mgr;
|
||||||
private:
|
|
||||||
int _errCode;
|
int _errCode;
|
||||||
bool _alive;
|
bool _alive;
|
||||||
bool _listening[32];
|
bool _listening[32];
|
||||||
|
scoped_ptr<webrtc::test::VoiceChannelTransport> voice_channel_transports_[32];
|
||||||
bool _playing[32];
|
bool _playing[32];
|
||||||
bool _sending[32];
|
bool _sending[32];
|
||||||
};
|
};
|
||||||
|
@ -23,13 +23,16 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "webrtc/voice_engine/test/auto_test/voe_stress_test.h"
|
#include "webrtc/voice_engine/test/auto_test/voe_stress_test.h"
|
||||||
#include "webrtc/voice_engine/test/auto_test/voe_standard_test.h"
|
|
||||||
|
|
||||||
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
#include "webrtc/system_wrappers/interface/sleep.h"
|
#include "webrtc/system_wrappers/interface/sleep.h"
|
||||||
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
||||||
|
#include "webrtc/test/channel_transport/include/channel_transport.h"
|
||||||
|
#include "webrtc/voice_engine/test/auto_test/voe_standard_test.h"
|
||||||
#include "webrtc/voice_engine/voice_engine_defines.h" // defines build macros
|
#include "webrtc/voice_engine/voice_engine_defines.h" // defines build macros
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
using namespace test;
|
||||||
|
|
||||||
namespace voetest {
|
namespace voetest {
|
||||||
|
|
||||||
@ -122,6 +125,7 @@ int VoEStressTest::StartStopTest() {
|
|||||||
|
|
||||||
// Get sub-API pointers
|
// Get sub-API pointers
|
||||||
VoEBase* base = _mgr.BasePtr();
|
VoEBase* base = _mgr.BasePtr();
|
||||||
|
VoENetwork* voe_network = _mgr.NetworkPtr();
|
||||||
|
|
||||||
// Set trace
|
// Set trace
|
||||||
// VALIDATE_STRESS(base->SetTraceFileName(
|
// VALIDATE_STRESS(base->SetTraceFileName(
|
||||||
@ -147,9 +151,12 @@ 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);
|
||||||
|
|
||||||
|
scoped_ptr<VoiceChannelTransport> voice_channel_transport(
|
||||||
|
new VoiceChannelTransport(voe_network, 0));
|
||||||
|
|
||||||
for (i = 0; i < numberOfLoops; ++i) {
|
for (i = 0; i < numberOfLoops; ++i) {
|
||||||
VALIDATE_STRESS(base->SetLocalReceiver(0, 4800));
|
voice_channel_transport->SetSendDestination("127.0.0.1", 4800);
|
||||||
VALIDATE_STRESS(base->SetSendDestination(0, 4800, "127.0.0.1"));
|
voice_channel_transport->SetLocalReceiver(4800);
|
||||||
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));
|
||||||
@ -162,8 +169,9 @@ int VoEStressTest::StartStopTest() {
|
|||||||
}
|
}
|
||||||
ANL();
|
ANL();
|
||||||
|
|
||||||
VALIDATE_STRESS(base->SetLocalReceiver(0, 4800));
|
VALIDATE_STRESS(voice_channel_transport->SetSendDestination("127.0.0.1",
|
||||||
VALIDATE_STRESS(base->SetSendDestination(0, 4800, "127.0.0.1"));
|
4800));
|
||||||
|
VALIDATE_STRESS(voice_channel_transport->SetLocalReceiver(4800));
|
||||||
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));
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "webrtc/voice_engine/test/auto_test/fakes/fake_media_process.h"
|
#include "webrtc/voice_engine/test/auto_test/fakes/fake_media_process.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
using namespace test;
|
||||||
|
|
||||||
namespace voetest {
|
namespace voetest {
|
||||||
|
|
||||||
@ -248,13 +249,17 @@ int VoEUnitTest::StartMedia(int channel, int rtpPort, bool listen, bool playout,
|
|||||||
bool send, bool fileAsMic, bool localFile) {
|
bool send, bool fileAsMic, bool localFile) {
|
||||||
VoEBase* base = _mgr.BasePtr();
|
VoEBase* base = _mgr.BasePtr();
|
||||||
VoEFile* file = _mgr.FilePtr();
|
VoEFile* file = _mgr.FilePtr();
|
||||||
|
VoENetwork* voe_network = _mgr.NetworkPtr();
|
||||||
|
|
||||||
_listening[channel] = false;
|
_listening[channel] = false;
|
||||||
_playing[channel] = false;
|
_playing[channel] = false;
|
||||||
_sending[channel] = false;
|
_sending[channel] = false;
|
||||||
|
voice_channel_transports_[channel].reset(
|
||||||
|
new VoiceChannelTransport(voe_network, channel));
|
||||||
|
|
||||||
CHECK(base->SetLocalReceiver(channel, rtpPort));
|
CHECK(voice_channel_transports_[channel]->SetLocalReceiver(rtpPort));
|
||||||
CHECK(base->SetSendDestination(channel, rtpPort, "127.0.0.1"));
|
CHECK(voice_channel_transports_[channel]->SetSendDestination("127.0.0.1",
|
||||||
|
rtpPort));
|
||||||
if (listen) {
|
if (listen) {
|
||||||
_listening[channel] = true;
|
_listening[channel] = true;
|
||||||
CHECK(base->StartReceive(channel));
|
CHECK(base->StartReceive(channel));
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
#ifndef WEBRTC_VOICE_ENGINE_VOE_UNIT_TEST_H
|
#ifndef WEBRTC_VOICE_ENGINE_VOE_UNIT_TEST_H
|
||||||
#define WEBRTC_VOICE_ENGINE_VOE_UNIT_TEST_H
|
#define WEBRTC_VOICE_ENGINE_VOE_UNIT_TEST_H
|
||||||
|
|
||||||
#include "voice_engine/test/auto_test/voe_standard_test.h"
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
|
#include "webrtc/test/channel_transport/include/channel_transport.h"
|
||||||
|
#include "webrtc/voice_engine/test/auto_test/voe_standard_test.h"
|
||||||
|
|
||||||
namespace voetest {
|
namespace voetest {
|
||||||
|
|
||||||
@ -57,6 +59,7 @@ class VoEUnitTest : public Encryption {
|
|||||||
bool _listening[32];
|
bool _listening[32];
|
||||||
bool _playing[32];
|
bool _playing[32];
|
||||||
bool _sending[32];
|
bool _sending[32];
|
||||||
|
scoped_ptr<webrtc::test::VoiceChannelTransport> voice_channel_transports_[32];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _extOnOff;
|
bool _extOnOff;
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "test/testsupport/fileutils.h"
|
|
||||||
|
|
||||||
#include "voe_errors.h"
|
#include "voe_errors.h"
|
||||||
#include "voe_base.h"
|
#include "voe_base.h"
|
||||||
#include "voe_codec.h"
|
#include "voe_codec.h"
|
||||||
@ -35,15 +33,17 @@
|
|||||||
#include "voe_network.h"
|
#include "voe_network.h"
|
||||||
#include "voe_neteq_stats.h"
|
#include "voe_neteq_stats.h"
|
||||||
#include "engine_configurations.h"
|
#include "engine_configurations.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
|
#include "webrtc/test/channel_transport/include/channel_transport.h"
|
||||||
|
#include "webrtc/test/testsupport/fileutils.h"
|
||||||
|
|
||||||
// Enable this this flag to run this test with hard coded
|
// Enable this this flag to run this test with hard coded
|
||||||
// IP/Port/codec and start test automatically with key input
|
// IP/Port/codec and start test automatically with key input
|
||||||
// it could be useful in repeat tests.
|
// it could be useful in repeat tests.
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
// #define EXTERNAL_TRANSPORT
|
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
using namespace test;
|
||||||
|
|
||||||
#define VALIDATE \
|
#define VALIDATE \
|
||||||
if (res != 0) \
|
if (res != 0) \
|
||||||
@ -70,29 +70,6 @@ VoENetEqStats* neteqst = NULL;
|
|||||||
|
|
||||||
void RunTest(std::string out_path);
|
void RunTest(std::string out_path);
|
||||||
|
|
||||||
#ifdef EXTERNAL_TRANSPORT
|
|
||||||
|
|
||||||
class my_transportation : public Transport
|
|
||||||
{
|
|
||||||
int SendPacket(int channel,const void *data,int len);
|
|
||||||
int SendRTCPPacket(int channel, const void *data, int len);
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_transportation::SendPacket(int channel,const void *data,int len)
|
|
||||||
{
|
|
||||||
netw->ReceivedRTPPacket(channel, data, len);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int my_transportation::SendRTCPPacket(int channel, const void *data, int len)
|
|
||||||
{
|
|
||||||
netw->ReceivedRTCPPacket(channel, data, len);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
my_transportation my_transport;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class MyObserver : public VoiceEngineObserver {
|
class MyObserver : public VoiceEngineObserver {
|
||||||
public:
|
public:
|
||||||
virtual void CallbackOnError(const int channel, const int err_code);
|
virtual void CallbackOnError(const int channel, const int err_code);
|
||||||
@ -270,44 +247,24 @@ void RunTest(std::string out_path) {
|
|||||||
cnt++;
|
cnt++;
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
#ifdef EXTERNAL_TRANSPORT
|
|
||||||
my_transportation ch0transport;
|
|
||||||
printf("Enabling external transport \n");
|
|
||||||
netw->RegisterExternalTransport(0, ch0transport);
|
|
||||||
#else
|
|
||||||
char ip[64];
|
char ip[64];
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
strcpy(ip, "127.0.0.1");
|
strcpy(ip, "127.0.0.1");
|
||||||
#else
|
#else
|
||||||
char localip[64];
|
|
||||||
netw->GetLocalIP(localip);
|
|
||||||
printf("local IP:%s\n", localip);
|
|
||||||
|
|
||||||
printf("1. 127.0.0.1 \n");
|
printf("1. 127.0.0.1 \n");
|
||||||
printf("2. Specify IP \n");
|
printf("2. Specify IP \n");
|
||||||
ASSERT_EQ(1, scanf("%i", &i));
|
ASSERT_EQ(1, scanf("%i", &i));
|
||||||
|
|
||||||
if (1 == i)
|
if (1 == i) {
|
||||||
strcpy(ip, "127.0.0.1");
|
strcpy(ip, "127.0.0.1");
|
||||||
else {
|
} else {
|
||||||
printf("Specify remote IP: ");
|
printf("Specify remote IP: ");
|
||||||
ASSERT_EQ(1, scanf("%s", ip));
|
ASSERT_EQ(1, scanf("%s", ip));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int colons(0);
|
int rPort = 8500;
|
||||||
while (ip[j] != '\0' && j < 64 && !(colons = (ip[j++] == ':')))
|
#ifndef DEBUG
|
||||||
;
|
|
||||||
if (colons) {
|
|
||||||
printf("Enabling IPv6\n");
|
|
||||||
res = netw->EnableIPv6(0);
|
|
||||||
VALIDATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int rPort;
|
|
||||||
#ifdef DEBUG
|
|
||||||
rPort=8500;
|
|
||||||
#else
|
|
||||||
printf("Specify remote port (1=1234): ");
|
printf("Specify remote port (1=1234): ");
|
||||||
ASSERT_EQ(1, scanf("%i", &rPort));
|
ASSERT_EQ(1, scanf("%i", &rPort));
|
||||||
if (1 == rPort)
|
if (1 == rPort)
|
||||||
@ -315,23 +272,24 @@ void RunTest(std::string out_path) {
|
|||||||
printf("Set Send port \n");
|
printf("Set Send port \n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
scoped_ptr<VoiceChannelTransport> voice_channel_transport(
|
||||||
|
new VoiceChannelTransport(netw, chan));
|
||||||
|
|
||||||
printf("Set Send IP \n");
|
printf("Set Send IP \n");
|
||||||
res = base1->SetSendDestination(chan, rPort, ip);
|
res = voice_channel_transport->SetSendDestination(ip, rPort);
|
||||||
VALIDATE;
|
VALIDATE;
|
||||||
|
|
||||||
int lPort;
|
int lPort = 8500;
|
||||||
#ifdef DEBUG
|
#ifndef DEBUG
|
||||||
lPort=8500;
|
|
||||||
#else
|
|
||||||
printf("Specify local port (1=1234): ");
|
printf("Specify local port (1=1234): ");
|
||||||
ASSERT_EQ(1, scanf("%i", &lPort));
|
ASSERT_EQ(1, scanf("%i", &lPort));
|
||||||
if (1 == lPort)
|
if (1 == lPort)
|
||||||
lPort = 1234;
|
lPort = 1234;
|
||||||
printf("Set Rec Port \n");
|
printf("Set Rec Port \n");
|
||||||
#endif
|
#endif
|
||||||
res = base1->SetLocalReceiver(chan, lPort);
|
|
||||||
|
res = voice_channel_transport->SetLocalReceiver(lPort);
|
||||||
VALIDATE;
|
VALIDATE;
|
||||||
#endif
|
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
for (i = 0; i < codec->NumOfCodecs(); i++) {
|
for (i = 0; i < codec->NumOfCodecs(); i++) {
|
||||||
@ -367,12 +325,19 @@ void RunTest(std::string out_path) {
|
|||||||
#endif
|
#endif
|
||||||
int channel_index = 0;
|
int channel_index = 0;
|
||||||
std::vector<int> channels(kMaxNumChannels);
|
std::vector<int> channels(kMaxNumChannels);
|
||||||
|
std::vector<scoped_ptr<VoiceChannelTransport> > voice_channel_transports;
|
||||||
|
|
||||||
for (i = 0; i < kMaxNumChannels; ++i) {
|
for (i = 0; i < kMaxNumChannels; ++i) {
|
||||||
channels[i] = base1->CreateChannel();
|
channels[i] = base1->CreateChannel();
|
||||||
int port = rPort + (i + 1) * 2;
|
int port = rPort + (i + 1) * 2;
|
||||||
res = base1->SetSendDestination(channels[i], port, ip);
|
|
||||||
|
voice_channel_transports[i].reset(
|
||||||
|
new VoiceChannelTransport(netw, channels[i]));
|
||||||
|
|
||||||
|
printf("Set Send IP \n");
|
||||||
|
res = voice_channel_transports[i]->SetSendDestination(ip, port);
|
||||||
VALIDATE;
|
VALIDATE;
|
||||||
res = base1->SetLocalReceiver(channels[i], port);
|
res = voice_channel_transports[i]->SetLocalReceiver(port);
|
||||||
VALIDATE;
|
VALIDATE;
|
||||||
res = codec->SetSendCodec(channels[i], cinst);
|
res = codec->SetSendCodec(channels[i], cinst);
|
||||||
VALIDATE;
|
VALIDATE;
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
'<(DEPTH)/testing/gmock.gyp:gmock',
|
'<(DEPTH)/testing/gmock.gyp:gmock',
|
||||||
'<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags',
|
'<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags',
|
||||||
'<(webrtc_root)/test/libtest/libtest.gyp:libtest',
|
'<(webrtc_root)/test/libtest/libtest.gyp:libtest',
|
||||||
],
|
'<(webrtc_root)/test/channel_transport.gyp:channel_transport',
|
||||||
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'auto_test',
|
'auto_test',
|
||||||
'auto_test/fixtures',
|
'auto_test/fixtures',
|
||||||
@ -102,6 +103,7 @@
|
|||||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||||
'voice_engine_core',
|
'voice_engine_core',
|
||||||
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
||||||
|
'<(webrtc_root)/test/channel_transport.gyp:channel_transport',
|
||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'cmd_test/voe_cmd_test.cc',
|
'cmd_test/voe_cmd_test.cc',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user