Move the VIE tests to use external transport instead of the built in udp transport

Review URL: https://webrtc-codereview.appspot.com/1216010

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3712 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org 2013-03-22 19:21:27 +00:00
parent c1ffd337f1
commit 26e35e1d06
18 changed files with 308 additions and 221 deletions

View File

@ -12,7 +12,9 @@
#include <stdio.h>
#ifndef WEBRTC_ANDROID
#include "gtest/gtest.h"
#endif
#include "webrtc/test/channel_transport/udp_transport.h"
#include "webrtc/video_engine/include/vie_network.h"
#include "webrtc/voice_engine/include/voe_network.h"
@ -27,8 +29,12 @@ VoiceChannelTransport::VoiceChannelTransport(VoENetwork* voe_network,
voe_network_(voe_network) {
WebRtc_UWord8 socket_threads = 1;
socket_transport_ = UdpTransport::Create(channel, socket_threads);
#ifndef WEBRTC_ANDROID
EXPECT_EQ(0, voe_network_->RegisterExternalTransport(channel,
*socket_transport_));
#else
voe_network_->RegisterExternalTransport(channel, *socket_transport_);
#endif
}
VoiceChannelTransport::~VoiceChannelTransport() {
@ -69,8 +75,12 @@ VideoChannelTransport::VideoChannelTransport(ViENetwork* vie_network,
vie_network_(vie_network) {
WebRtc_UWord8 socket_threads = 1;
socket_transport_ = UdpTransport::Create(channel, socket_threads);
#ifndef WEBRTC_ANDROID
EXPECT_EQ(0, vie_network_->RegisterSendTransport(channel,
*socket_transport_));
#else
vie_network_->RegisterSendTransport(channel, *socket_transport_);
#endif
}
VideoChannelTransport::~VideoChannelTransport() {

View File

@ -218,6 +218,12 @@ LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libudp_transport.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libchannel_transport
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/libchannel_transport.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libwebrtc_utility
LOCAL_SRC_FILES := \
@ -349,6 +355,7 @@ LOCAL_STATIC_LIBRARIES := \
librtp_rtcp \
libmedia_file \
libudp_transport \
libchannel_transport \
libwebrtc_utility \
libaudio_conference_mixer \
libyuv \

View File

@ -34,6 +34,9 @@
#include "common_types.h"
#include "android_media_codec_decoder.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/test/channel_transport/include/channel_transport.h"
#define WEBRTC_LOG_TAG "*WEBRTCN*"
#define VALIDATE_BASE_POINTER \
if (!voeData.base) \
@ -88,6 +91,7 @@
}
using namespace webrtc;
using namespace test;
//Forward declaration.
class VideoCallbackAndroid;
@ -107,6 +111,7 @@ typedef struct
VoEHardware* hardware;
VoERTP_RTCP* rtp;
JavaVM* jvm;
scoped_ptr<VoiceChannelTransport> transport;
} VoiceEngineData;
class AndroidVideoRenderCallback;
@ -122,7 +127,7 @@ typedef struct
ViECapture* capture;
ViEExternalCodec* externalCodec;
VideoCallbackAndroid* callback;
scoped_ptr<VideoChannelTransport> transport;
} VideoEngineData;
// Global variables
@ -589,7 +594,7 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_CreateCh
if (voiceChannel >= 0) {
vieData.base->ConnectAudioChannel(channel, voiceChannel);
}
vieData.transport.reset(new VideoChannelTransport(vieData.netw, channel));
return channel;
}
else {
@ -610,13 +615,10 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_SetLocal
{
__android_log_write(ANDROID_LOG_DEBUG, WEBRTC_LOG_TAG, "SetLocalReceiver");
if (vieData.vie) {
int ret = vieData.netw->SetLocalReceiver(channel, port);
return ret;
}
else {
return -1;
if (vieData.transport.get()) {
return vieData.transport->SetLocalReceiver(port);
}
return -1;
}
/*
@ -646,7 +648,10 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_SetSendD
"SetSendDestination: channel=%d, port=%d, ip=%s\n",
channel, port, ip);
return vieData.netw->SetSendDestination(channel, ip, port);
if (vieData.transport.get()) {
return vieData.transport->SetSendDestination(ip, port);
}
return -1;
}
@ -1264,7 +1269,7 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Cre
}
jint channel = voeData.base->CreateChannel();
voeData.transport.reset(new VoiceChannelTransport(voeData.netw, channel));
return channel;
}
@ -1295,7 +1300,10 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Set
{
__android_log_write(ANDROID_LOG_DEBUG, WEBRTC_LOG_TAG, "SetLocalReceiver");
VALIDATE_BASE_POINTER;
return voeData.base->SetLocalReceiver(channel, port);
if (voeData.transport.get()) {
return voeData.transport->SetLocalReceiver(port);
}
return -1;
}
/*
@ -1319,9 +1327,13 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Set
"Could not get UTF string");
return -1;
}
jint retVal = voeData.base->SetSendDestination(channel, port, ipaddrNative);
if (voeData.transport.get()) {
jint retVal = voeData.transport->SetSendDestination(ipaddrNative, port);
env->ReleaseStringUTFChars(ipaddr, ipaddrNative);
return retVal;
}
env->ReleaseStringUTFChars(ipaddr, ipaddrNative);
return retVal;
return -1;
}
/*

View File

@ -48,10 +48,6 @@ TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest),
tests_->ViEImageProcessAPITest();
}
TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), RunsNetworkTestWithoutErrors) {
tests_->ViENetworkAPITest();
}
TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), RunsRenderTestWithoutErrors) {
tests_->ViERenderAPITest();
}

View File

@ -50,11 +50,6 @@ TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest),
tests_->ViEImageProcessExtendedTest();
}
TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest),
RunsNetworkTestWithoutErrors) {
tests_->ViENetworkExtendedTest();
}
TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest),
RunsRenderTestWithoutErrors) {
tests_->ViERenderExtendedTest();

View File

@ -54,10 +54,6 @@ TEST_F(ViEStandardIntegrationTest, RunsImageProcessTestWithoutErrors) {
tests_->ViEImageProcessStandardTest();
}
TEST_F(ViEStandardIntegrationTest, RunsNetworkTestWithoutErrors) {
tests_->ViENetworkStandardTest();
}
TEST_F(ViEStandardIntegrationTest, RunsRenderTestWithoutErrors) {
tests_->ViERenderStandardTest();
}

View File

@ -67,7 +67,6 @@ void ViEAutoTest::ViEStandardTest()
ViEEncryptionStandardTest();
ViEFileStandardTest();
ViEImageProcessStandardTest();
ViENetworkStandardTest();
ViERenderStandardTest();
ViERtpRtcpStandardTest();
}
@ -80,7 +79,6 @@ void ViEAutoTest::ViEExtendedTest()
ViEEncryptionExtendedTest();
ViEFileExtendedTest();
ViEImageProcessExtendedTest();
ViENetworkExtendedTest();
ViERenderExtendedTest();
ViERtpRtcpExtendedTest();
}
@ -93,7 +91,6 @@ void ViEAutoTest::ViEAPITest()
ViEEncryptionAPITest();
ViEFileAPITest();
ViEImageProcessAPITest();
ViENetworkAPITest();
ViERenderAPITest();
ViERtpRtcpAPITest();
}

View File

@ -162,21 +162,14 @@ int ViEAutoTestAndroid::RunAutotest(int testSelection, int subTestSelection,
vieAutoTest.ViEImageProcessExtendedTest();
break;
case 8: // network
vieAutoTest.ViENetworkExtendedTest();
break;
case 9: // Render
case 8: // Render
vieAutoTest.ViERenderExtendedTest();
break;
case 10: // RTP/RTCP
case 9: // RTP/RTCP
vieAutoTest.ViERtpRtcpExtendedTest();
break;
case 11:
break;
default:
break;
}

View File

@ -9,11 +9,12 @@
*/
#include "webrtc/modules/video_capture/include/video_capture_factory.h"
#include "video_engine/test/auto_test/interface/vie_autotest.h"
#include "video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "video_engine/test/auto_test/primitives/base_primitives.h"
#include "video_engine/test/auto_test/primitives/general_primitives.h"
#include "video_engine/test/libvietest/include/tb_interfaces.h"
#include "webrtc/test/channel_transport/include/channel_transport.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "webrtc/video_engine/test/auto_test/primitives/base_primitives.h"
#include "webrtc/video_engine/test/auto_test/primitives/general_primitives.h"
#include "webrtc/video_engine/test/libvietest/include/tb_interfaces.h"
void ViEAutoTest::ViEBaseStandardTest() {
// ***************************************************************
@ -150,20 +151,30 @@ void ViEAutoTest::ViEBaseAPITest() {
// Create a receive only channel and a send channel. Verify we can't send on
// the receive only channel.
EXPECT_EQ(0, vie_base->CreateReceiveChannel(video_channel2,
video_channel));
video_channel));
EXPECT_EQ(0, vie_base->CreateChannel(video_channel3, video_channel));
const char* ip_address = "127.0.0.1\0";
const int send_port = 1234;
EXPECT_EQ(0, vie_rtp->SetLocalSSRC(video_channel, 1));
EXPECT_EQ(0, vie_network->SetSendDestination(video_channel, ip_address,
send_port));
EXPECT_EQ(0, vie_rtp->SetLocalSSRC(video_channel, 2));
EXPECT_EQ(0, vie_network->SetSendDestination(video_channel2, ip_address,
send_port + 2));
EXPECT_EQ(0, vie_rtp->SetLocalSSRC(video_channel, 3));
EXPECT_EQ(0, vie_network->SetSendDestination(video_channel3, ip_address,
send_port + 4));
webrtc::test::VideoChannelTransport* video_channel_transport_1 =
new webrtc::test::VideoChannelTransport(vie_network, video_channel);
ASSERT_EQ(0, video_channel_transport_1->SetSendDestination(ip_address,
send_port));
webrtc::test::VideoChannelTransport* video_channel_transport_2 =
new webrtc::test::VideoChannelTransport(vie_network, video_channel2);
webrtc::test::VideoChannelTransport* video_channel_transport_3 =
new webrtc::test::VideoChannelTransport(vie_network, video_channel3);
ASSERT_EQ(0, video_channel_transport_3->SetSendDestination(ip_address,
send_port + 4));
EXPECT_EQ(0, vie_base->StartSend(video_channel));
EXPECT_EQ(-1, vie_base->StartSend(video_channel2));
@ -220,6 +231,9 @@ void ViEAutoTest::ViEBaseAPITest() {
EXPECT_FALSE(webrtc::VideoEngine::Delete(video_engine)) <<
"Should fail since there are interfaces left.";
delete video_channel_transport_1;
delete video_channel_transport_2;
delete video_channel_transport_3;
EXPECT_EQ(0, vie_base->Release());
EXPECT_TRUE(webrtc::VideoEngine::Delete(video_engine));
}

View File

@ -8,21 +8,24 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "common_types.h" // NOLINT
#include "engine_configurations.h" // NOLINT
#include "video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "video_engine/test/auto_test/interface/vie_autotest.h"
#include "video_engine/test/libvietest/include/tb_capture_device.h"
#include "video_engine/test/libvietest/include/tb_I420_codec.h"
#include "video_engine/test/libvietest/include/tb_interfaces.h"
#include "video_engine/test/libvietest/include/tb_video_channel.h"
#include "video_engine/include/vie_base.h"
#include "video_engine/include/vie_capture.h"
#include "video_engine/include/vie_codec.h"
#include "video_engine/include/vie_network.h"
#include "video_engine/include/vie_render.h"
#include "video_engine/include/vie_rtp_rtcp.h"
#include "voice_engine/include/voe_base.h"
#include "webrtc/common_types.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/test/channel_transport/include/channel_transport.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h"
#include "webrtc/video_engine/test/libvietest/include/tb_capture_device.h"
#include "webrtc/video_engine/test/libvietest/include/tb_I420_codec.h"
#include "webrtc/video_engine/test/libvietest/include/tb_interfaces.h"
#include "webrtc/video_engine/test/libvietest/include/tb_video_channel.h"
#include "webrtc/video_engine/include/vie_base.h"
#include "webrtc/video_engine/include/vie_capture.h"
#include "webrtc/video_engine/include/vie_codec.h"
#include "webrtc/video_engine/include/vie_external_codec.h"
#include "webrtc/video_engine/include/vie_network.h"
#include "webrtc/video_engine/include/vie_render.h"
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
#include "webrtc/voice_engine/include/voe_base.h"
class TestCodecObserver
: public webrtc::ViEEncoderObserver,
@ -164,13 +167,18 @@ void ViEAutoTest::ViECodecStandardTest() {
break;
}
}
const char* ip_address = "127.0.0.1";
const uint16_t rtp_port = 6000;
EXPECT_EQ(0, network->SetLocalReceiver(video_channel, rtp_port));
webrtc::scoped_ptr<webrtc::test::VideoChannelTransport>
video_channel_transport(
new webrtc::test::VideoChannelTransport(network, video_channel));
ASSERT_EQ(0, video_channel_transport->SetSendDestination(ip_address,
rtp_port));
ASSERT_EQ(0, video_channel_transport->SetLocalReceiver(rtp_port));
EXPECT_EQ(0, base->StartReceive(video_channel));
EXPECT_EQ(0, network->SetSendDestination(
video_channel, ip_address, rtp_port));
EXPECT_EQ(0, base->StartSend(video_channel));
// Make sure all codecs runs
@ -300,11 +308,17 @@ void ViEAutoTest::ViECodecExtendedTest() {
const char* ip_address = "127.0.0.1";
const uint16_t rtp_port = 6000;
EXPECT_EQ(0, network->SetLocalReceiver(video_channel, rtp_port));
EXPECT_EQ(0, base->StartReceive(video_channel));
EXPECT_EQ(0, network->SetSendDestination(
video_channel, ip_address, rtp_port));
webrtc::scoped_ptr<webrtc::test::VideoChannelTransport>
video_channel_transport(
new webrtc::test::VideoChannelTransport(network, video_channel));
ASSERT_EQ(0, video_channel_transport->SetSendDestination(ip_address,
rtp_port));
ASSERT_EQ(0, video_channel_transport->SetLocalReceiver(rtp_port));
EXPECT_EQ(0, base->StartSend(video_channel));
EXPECT_EQ(0, base->StartReceive(video_channel));
// Codec specific tests
memset(&video_codec, 0, sizeof(webrtc::VideoCodec));
@ -329,6 +343,7 @@ void ViEAutoTest::ViECodecExtendedTest() {
// the received streams.
TbInterfaces video_engine("ViECodecExtendedTest2");
TbCaptureDevice tb_capture(video_engine);
webrtc::ViENetwork* network = video_engine.network;
// Create channel 1.
int video_channel_1 = -1;
@ -341,17 +356,27 @@ void ViEAutoTest::ViECodecExtendedTest() {
EXPECT_NE(video_channel_1, video_channel_2)
<< "Channel 2 should be unique.";
const char* ip_address = "127.0.0.1";
uint16_t rtp_port_1 = 12000;
uint16_t rtp_port_2 = 13000;
EXPECT_EQ(0, video_engine.network->SetLocalReceiver(
video_channel_1, rtp_port_1));
EXPECT_EQ(0, video_engine.network->SetSendDestination(
video_channel_1, "127.0.0.1", rtp_port_1));
webrtc::scoped_ptr<webrtc::test::VideoChannelTransport>
video_channel_transport_1(
new webrtc::test::VideoChannelTransport(network, video_channel_1));
ASSERT_EQ(0, video_channel_transport_1->SetSendDestination(ip_address,
rtp_port_1));
ASSERT_EQ(0, video_channel_transport_1->SetLocalReceiver(rtp_port_1));
webrtc::scoped_ptr<webrtc::test::VideoChannelTransport>
video_channel_transport_2(
new webrtc::test::VideoChannelTransport(network, video_channel_2));
ASSERT_EQ(0, video_channel_transport_2->SetSendDestination(ip_address,
rtp_port_2));
ASSERT_EQ(0, video_channel_transport_2->SetLocalReceiver(rtp_port_2));
EXPECT_EQ(0, video_engine.rtp_rtcp->SetLocalSSRC(video_channel_1, 1));
EXPECT_EQ(0, video_engine.network->SetLocalReceiver(
video_channel_2, rtp_port_2));
EXPECT_EQ(0, video_engine.network->SetSendDestination(
video_channel_2, "127.0.0.1", rtp_port_2));
EXPECT_EQ(0, video_engine.rtp_rtcp->SetLocalSSRC(video_channel_2, 2));
tb_capture.ConnectTo(video_channel_1);
tb_capture.ConnectTo(video_channel_2);
@ -483,9 +508,6 @@ void ViEAutoTest::ViECodecAPITest() {
EXPECT_TRUE(webrtc::VideoEngine::Delete(video_engine));
}
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
#include "video_engine/include/vie_external_codec.h"
#endif
void ViEAutoTest::ViECodecExternalCodecTest() {
ViETest::Log(" ");
ViETest::Log("========================================");

View File

@ -15,12 +15,15 @@
#include <algorithm>
#include "gflags/gflags.h"
#include "video_engine/test/auto_test/interface/vie_autotest.h"
#include "video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "video_engine/test/auto_test/primitives/choice_helpers.h"
#include "video_engine/test/auto_test/primitives/general_primitives.h"
#include "video_engine/test/auto_test/primitives/input_helpers.h"
#include "video_engine/test/libvietest/include/vie_to_file_renderer.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/test/channel_transport/include/channel_transport.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "webrtc/video_engine/test/auto_test/primitives/choice_helpers.h"
#include "webrtc/video_engine/test/auto_test/primitives/general_primitives.h"
#include "webrtc/video_engine/test/auto_test/primitives/input_helpers.h"
#include "webrtc/video_engine/test/libvietest/include/vie_to_file_renderer.h"
#include "webrtc/voice_engine/include/voe_network.h"
#define VCM_RED_PAYLOAD_TYPE 96
#define VCM_ULPFEC_PAYLOAD_TYPE 97
@ -202,6 +205,12 @@ int ViEAutoTest::ViECustomCall() {
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
webrtc::VoENetwork* voe_network=
webrtc::VoENetwork::GetInterface(voe);
number_of_errors += ViETest::TestError(voe_network != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
webrtc::VoEAudioProcessing* voe_apm =
webrtc::VoEAudioProcessing::GetInterface(voe);
number_of_errors += ViETest::TestError(voe_apm != NULL,
@ -270,6 +279,10 @@ int ViEAutoTest::ViECustomCall() {
int buffer_delay_ms = 0;
bool is_image_scale_enabled = false;
bool remb = true;
webrtc::scoped_ptr<webrtc::test::VideoChannelTransport>
video_channel_transport;
webrtc::scoped_ptr<webrtc::test::VoiceChannelTransport>
voice_channel_transport;
while (!start_call) {
// Get the IP address to use from call.
@ -340,13 +353,17 @@ int ViEAutoTest::ViECustomCall() {
if (start_call == true) {
// Configure audio channel first.
audio_channel = voe_base->CreateChannel();
error = voe_base->SetSendDestination(audio_channel, audio_tx_port,
ip_address.c_str());
voice_channel_transport.reset(
new webrtc::test::VoiceChannelTransport(voe_network, audio_channel));
error = voice_channel_transport->SetSendDestination(ip_address.c_str(),
audio_tx_port);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = voe_base->SetLocalReceiver(audio_channel, audio_rx_port);
error = voice_channel_transport->SetLocalReceiver(audio_rx_port);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -472,13 +489,17 @@ int ViEAutoTest::ViECustomCall() {
file_renderer.PrepareForRendering(output_path, filename);
RenderToFile(vie_renderer, video_channel, &file_renderer);
}
error = vie_network->SetSendDestination(video_channel, ip_address.c_str(),
video_tx_port);
video_channel_transport.reset(
new webrtc::test::VideoChannelTransport(vie_network, video_channel));
error = video_channel_transport->SetSendDestination(ip_address.c_str(),
video_tx_port);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = vie_network->SetLocalReceiver(video_channel, video_rx_port);
error = video_channel_transport->SetLocalReceiver(video_rx_port);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -912,6 +933,9 @@ int ViEAutoTest::ViECustomCall() {
// Now tear down the ViE engine.
error = vie_base->DisconnectAudioChannel(video_channel);
voice_channel_transport.reset(NULL);
video_channel_transport.reset(NULL);
// If Encoder/Decoder Observer is running, delete them.
if (codec_encoder_observer) {
error = vie_codec->DeregisterEncoderObserver(video_channel);

View File

@ -18,6 +18,9 @@
#include "voe_codec.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/test/channel_transport/include/channel_transport.h"
class ViEAutotestFileObserver: public webrtc::ViEFileObserver
{
public:
@ -103,14 +106,19 @@ void ViEAutoTest::ViEFileStandardTest()
break;
}
}
const char* ipAddress = "127.0.0.1";
const unsigned short rtpPort = 6000;
EXPECT_EQ(0, ptrViENetwork->SetLocalReceiver(videoChannel, rtpPort));
webrtc::scoped_ptr<webrtc::test::VideoChannelTransport>
video_channel_transport(
new webrtc::test::VideoChannelTransport(ptrViENetwork,
videoChannel));
EXPECT_EQ(0, video_channel_transport->SetSendDestination(ipAddress,
rtpPort));
EXPECT_EQ(0, video_channel_transport->SetLocalReceiver(rtpPort));
EXPECT_EQ(0, ptrViEBase->StartReceive(videoChannel));
EXPECT_EQ(0, ptrViENetwork->SetSendDestination(
videoChannel, ipAddress, rtpPort));
EXPECT_EQ(0, ptrViEBase->StartSend(videoChannel));
webrtc::ViEFile* ptrViEFile = webrtc::ViEFile::GetInterface(ptrViE);
EXPECT_TRUE(ptrViEFile != NULL);

View File

@ -34,6 +34,8 @@
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "webrtc/video_engine/test/libvietest/include/tb_external_transport.h"
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/test/channel_transport/include/channel_transport.h"
#define VCM_RED_PAYLOAD_TYPE 96
#define VCM_ULPFEC_PAYLOAD_TYPE 97
@ -495,6 +497,9 @@ int VideoEngineSampleCode(void* window1, void* window2)
// Setting External transport
TbExternalTransport extTransport(*(ptrViENetwork), videoChannel, NULL);
webrtc::test::VideoChannelTransport* video_channel_transport =
new webrtc::test::VideoChannelTransport(ptrViENetwork, videoChannel);
int testMode = 0;
std::cout << std::endl;
std::cout << "Enter 1 for testing packet loss and delay with "
@ -547,17 +552,17 @@ int VideoEngineSampleCode(void* window1, void* window2)
std::cout << std::endl;
std::cout << "Using rtp port: " << rtpPort << std::endl;
std::cout << std::endl;
error = ptrViENetwork->SetLocalReceiver(videoChannel, rtpPort);
error = video_channel_transport->SetLocalReceiver(rtpPort);
if (error == -1)
{
printf("ERROR in ViENetwork::SetLocalReceiver\n");
printf("ERROR in SetLocalReceiver\n");
return -1;
}
error = ptrViENetwork->SetSendDestination(videoChannel,
ipAddress, rtpPort);
error = video_channel_transport->SetSendDestination(ipAddress, rtpPort);
if (error == -1)
{
printf("ERROR in ViENetwork::SetSendDestination\n");
printf("ERROR in SetSendDestination\n");
return -1;
}
}
@ -660,7 +665,7 @@ int VideoEngineSampleCode(void* window1, void* window2)
printf("ERROR in ViEBase::DeleteChannel\n");
return -1;
}
delete video_channel_transport;
int remainingInterfaces = 0;
remainingInterfaces = ptrViECodec->Release();
remainingInterfaces += ptrViECapture->Release();

View File

@ -17,20 +17,22 @@
#include <stdio.h>
#include <fstream>
#include "common_types.h"
#include "video_engine/test/libvietest/include/tb_external_transport.h"
#include "voice_engine/include/voe_base.h"
#include "video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "video_engine/test/auto_test/interface/vie_autotest.h"
#include "video_engine/include/vie_base.h"
#include "video_engine/include/vie_capture.h"
#include "video_engine/include/vie_codec.h"
#include "video_engine/include/vie_file.h"
#include "video_engine/include/vie_network.h"
#include "video_engine/include/vie_render.h"
#include "video_engine/include/vie_rtp_rtcp.h"
#include "voice_engine/include/voe_rtp_rtcp.h"
#include "system_wrappers/interface/tick_util.h"
#include "webrtc/common_types.h"
#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/test/channel_transport/include/channel_transport.h"
#include "webrtc/video_engine/test/libvietest/include/tb_external_transport.h"
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h"
#include "webrtc/video_engine/include/vie_base.h"
#include "webrtc/video_engine/include/vie_capture.h"
#include "webrtc/video_engine/include/vie_codec.h"
#include "webrtc/video_engine/include/vie_file.h"
#include "webrtc/video_engine/include/vie_network.h"
#include "webrtc/video_engine/include/vie_render.h"
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
#include "webrtc/voice_engine/include/voe_network.h"
#include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
#define VCM_RED_PAYLOAD_TYPE 96
#define VCM_ULPFEC_PAYLOAD_TYPE 97
@ -139,6 +141,8 @@ int VideoEngineSampleRecordCode(void* window1, void* window2) {
webrtc::VoECodec* voe_codec = webrtc::VoECodec::GetInterface(voe);
webrtc::VoEAudioProcessing* voe_apm =
webrtc::VoEAudioProcessing::GetInterface(voe);
webrtc::VoENetwork* voe_network =
webrtc::VoENetwork::GetInterface(voe);
// Get the audio device for the call.
memset(audio_capture_device_name, 0, KMaxUniqueIdLength);
@ -147,20 +151,24 @@ int VideoEngineSampleRecordCode(void* window1, void* window2) {
audio_capture_device_index, audio_playbackDeviceName,
audio_playback_device_index);
// Get the audio codec for the call.
memset(static_cast<void*>(&audio_codec), 0, sizeof(audio_codec));
GetAudioCodecRecord(voe_codec, audio_codec);
audio_channel = voe_base->CreateChannel();
error = voe_base->SetSendDestination(audio_channel, audio_tx_port,
ipAddress);
error = voe_base->SetLocalReceiver(audio_channel, audio_rx_port);
error = voe_hardware->SetRecordingDevice(audio_capture_device_index);
error = voe_hardware->SetPlayoutDevice(audio_playback_device_index);
error = voe_codec->SetSendCodec(audio_channel, audio_codec);
error = voe_apm->SetAgcStatus(true, webrtc::kAgcDefault);
error = voe_apm->SetNsStatus(true, webrtc::kNsHighSuppression);
webrtc::scoped_ptr<webrtc::test::VoiceChannelTransport>
voice_channel_transport(
new webrtc::test::VoiceChannelTransport(voe_network, audio_channel));
voice_channel_transport->SetSendDestination(ipAddress, audio_tx_port);
voice_channel_transport->SetLocalReceiver(audio_rx_port);
voe_hardware->SetRecordingDevice(audio_capture_device_index);
voe_hardware->SetPlayoutDevice(audio_playback_device_index);
voe_codec->SetSendCodec(audio_channel, audio_codec);
voe_apm->SetAgcStatus(true, webrtc::kAgcDefault);
voe_apm->SetNsStatus(true, webrtc::kNsHighSuppression);
//
// List available capture devices, allocate and connect.
@ -352,18 +360,17 @@ int VideoEngineSampleRecordCode(void* window1, void* window2) {
printf("ERROR in ViENetwork::GetInterface\n");
return -1;
}
webrtc::test::VideoChannelTransport* video_channel_transport =
new webrtc::test::VideoChannelTransport(ptrViENetwork, videoChannel);
// Setting External transport
TbExternalTransport extTransport(*(ptrViENetwork), videoChannel, NULL);
error = ptrViENetwork->SetLocalReceiver(videoChannel, rtpPort);
error = video_channel_transport->SetSendDestination(ipAddress, rtpPort);
if (error == -1) {
printf("ERROR in ViENetwork::SetLocalReceiver\n");
printf("ERROR in SetSendDestination\n");
return -1;
}
error = ptrViENetwork->SetSendDestination(videoChannel,
ipAddress, rtpPort);
error = video_channel_transport->SetLocalReceiver(rtpPort);
if (error == -1) {
printf("ERROR in ViENetwork::SetSendDestination\n");
printf("ERROR in SetLocalReceiver\n");
return -1;
}
@ -520,6 +527,7 @@ int VideoEngineSampleRecordCode(void* window1, void* window2) {
printf("ERROR in ViEBase::DeleteChannel\n");
return -1;
}
delete video_channel_transport;
int remainingInterfaces = 0;
remainingInterfaces = ptrViECodec->Release();
@ -532,7 +540,6 @@ int VideoEngineSampleRecordCode(void* window1, void* window2) {
printf("ERROR: Could not release all interfaces\n");
return -1;
}
bool deleted = webrtc::VideoEngine::Delete(ptrViE);
if (deleted == false) {
printf("ERROR in VideoEngine::Delete\n");
@ -564,7 +571,7 @@ int ViEAutoTest::ViERecordCall() {
}
bool GetAudioCodecRecord(webrtc::VoECodec* voe_codec,
webrtc::CodecInst& audio_codec) {
webrtc::CodecInst& audio_codec) {
int error = 0;
int number_of_errors = 0;
memset(&audio_codec, 0, sizeof(webrtc::CodecInst));

View File

@ -104,6 +104,7 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
TbExternalTransport myTransport(*(ViE.network), tbChannel.videoChannel,
NULL);
ViE.network->DeregisterSendTransport(tbChannel.videoChannel);
EXPECT_EQ(0, ViE.network->RegisterSendTransport(
tbChannel.videoChannel, myTransport));

View File

@ -20,6 +20,7 @@
'<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags',
'<(webrtc_root)/test/metrics.gyp:metrics',
'<(webrtc_root)/test/test.gyp:test_support',
'<(webrtc_root)/test/channel_transport.gyp:channel_transport',
'<(webrtc_root)/test/libtest/libtest.gyp:libtest',
'video_engine_core',
'libvietest',
@ -81,7 +82,6 @@
'source/vie_autotest_image_process.cc',
'source/vie_autotest_loopback.cc',
'source/vie_autotest_main.cc',
'source/vie_autotest_network.cc',
'source/vie_autotest_render.cc',
'source/vie_autotest_record.cc',
'source/vie_autotest_rtp_rtcp.cc',

View File

@ -11,32 +11,41 @@
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_VIDEO_CHANNEL_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_VIDEO_CHANNEL_H_
#include "video_engine/test/libvietest/include/tb_interfaces.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/video_engine/test/libvietest/include/tb_interfaces.h"
class TbVideoChannel
{
public:
TbVideoChannel(TbInterfaces& Engine,
webrtc::VideoCodecType sendCodec = webrtc::kVideoCodecVP8,
int width = 352, int height = 288, int frameRate = 30,
int startBitrate = 300);
namespace webrtc {
namespace test {
class VideoChannelTransport;
} // namespace test
} // namespace webrtc
~TbVideoChannel(void);
class TbVideoChannel {
public:
TbVideoChannel(TbInterfaces& Engine,
webrtc::VideoCodecType sendCodec = webrtc::kVideoCodecVP8,
int width = 352, int height = 288, int frameRate = 30,
int startBitrate = 300);
void SetFrameSettings(int width, int height, int frameRate);
~TbVideoChannel(void);
void StartSend(const unsigned short rtpPort = 11000,
const char* ipAddress = "127.0.0.1");
void SetFrameSettings(int width, int height, int frameRate);
void StopSend();
void StartSend(const unsigned short rtpPort = 11000,
const char* ipAddress = "127.0.0.1");
void StartReceive(const unsigned short rtpPort = 11000);
void StopSend();
void StopReceive();
void StartReceive(const unsigned short rtpPort = 11000);
int videoChannel;
private:
TbInterfaces& ViE;
void StopReceive();
int videoChannel;
private:
TbInterfaces& ViE;
webrtc::scoped_ptr<webrtc::test::VideoChannelTransport> channel_transport_;
};
#endif // WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_VIDEO_CHANNEL_H_

View File

@ -11,82 +11,73 @@
#include "video_engine/test/libvietest/include/tb_video_channel.h"
#include "gtest/gtest.h"
#include "webrtc/test/channel_transport/include/channel_transport.h"
TbVideoChannel::TbVideoChannel(TbInterfaces& Engine,
webrtc::VideoCodecType sendCodec, int width,
int height, int frameRate, int startBitrate) :
videoChannel(-1), ViE(Engine)
{
EXPECT_EQ(0, ViE.base->CreateChannel(videoChannel));
int height, int frameRate, int startBitrate)
: videoChannel(-1),
ViE(Engine) {
EXPECT_EQ(0, ViE.base->CreateChannel(videoChannel));
channel_transport_.reset(new webrtc::test::VideoChannelTransport(
ViE.network, videoChannel));
webrtc::VideoCodec videoCodec;
memset(&videoCodec, 0, sizeof(webrtc::VideoCodec));
bool sendCodecSet = false;
for (int idx = 0; idx < ViE.codec->NumberOfCodecs(); idx++)
{
EXPECT_EQ(0, ViE.codec->GetCodec(idx, videoCodec));
videoCodec.width = width;
videoCodec.height = height;
videoCodec.maxFramerate = frameRate;
if (videoCodec.codecType == sendCodec && sendCodecSet == false)
{
if(videoCodec.codecType != webrtc::kVideoCodecI420 )
{
videoCodec.startBitrate = startBitrate;
videoCodec.maxBitrate = startBitrate * 3;
}
EXPECT_EQ(0, ViE.codec->SetSendCodec(videoChannel, videoCodec));
sendCodecSet = true;
}
if (videoCodec.codecType == webrtc::kVideoCodecVP8)
{
videoCodec.width = 352;
videoCodec.height = 288;
}
EXPECT_EQ(0, ViE.codec->SetReceiveCodec(videoChannel, videoCodec));
}
EXPECT_TRUE(sendCodecSet);
}
TbVideoChannel::~TbVideoChannel(void)
{
EXPECT_EQ(0, ViE.base->DeleteChannel(videoChannel));
}
void TbVideoChannel::StartSend(const unsigned short rtpPort /*= 11000*/,
const char* ipAddress /*= "127.0.0.1"*/)
{
EXPECT_EQ(0, ViE.network->SetSendDestination(videoChannel, ipAddress,
rtpPort));
EXPECT_EQ(0, ViE.base->StartSend(videoChannel));
}
void TbVideoChannel::SetFrameSettings(int width, int height, int frameRate)
{
webrtc::VideoCodec videoCodec;
EXPECT_EQ(0, ViE.codec->GetSendCodec(videoChannel, videoCodec));
webrtc::VideoCodec videoCodec;
memset(&videoCodec, 0, sizeof(webrtc::VideoCodec));
bool sendCodecSet = false;
for (int idx = 0; idx < ViE.codec->NumberOfCodecs(); idx++) {
EXPECT_EQ(0, ViE.codec->GetCodec(idx, videoCodec));
videoCodec.width = width;
videoCodec.height = height;
videoCodec.maxFramerate = frameRate;
EXPECT_EQ(0, ViE.codec->SetSendCodec(videoChannel, videoCodec));
if (videoCodec.codecType == sendCodec && sendCodecSet == false) {
if (videoCodec.codecType != webrtc::kVideoCodecI420) {
videoCodec.startBitrate = startBitrate;
videoCodec.maxBitrate = startBitrate * 3;
}
EXPECT_EQ(0, ViE.codec->SetSendCodec(videoChannel, videoCodec));
sendCodecSet = true;
}
if (videoCodec.codecType == webrtc::kVideoCodecVP8) {
videoCodec.width = 352;
videoCodec.height = 288;
}
EXPECT_EQ(0, ViE.codec->SetReceiveCodec(videoChannel, videoCodec));
}
EXPECT_TRUE(sendCodecSet);
}
void TbVideoChannel::StopSend()
{
EXPECT_EQ(0, ViE.base->StopSend(videoChannel));
TbVideoChannel::~TbVideoChannel() {
EXPECT_EQ(0, ViE.base->DeleteChannel(videoChannel));
}
void TbVideoChannel::StartReceive(const unsigned short rtpPort /*= 11000*/)
{
EXPECT_EQ(0, ViE.network->SetLocalReceiver(videoChannel, rtpPort));
EXPECT_EQ(0, ViE.base->StartReceive(videoChannel));
void TbVideoChannel::StartSend(const unsigned short rtp_port,
const char* ip_address) {
EXPECT_EQ(0, channel_transport_->SetSendDestination(ip_address, rtp_port));
EXPECT_EQ(0, ViE.base->StartSend(videoChannel));
}
void TbVideoChannel::StopReceive()
{
EXPECT_EQ(0, ViE.base->StopReceive(videoChannel));
void TbVideoChannel::SetFrameSettings(int width, int height, int frameRate) {
webrtc::VideoCodec videoCodec;
EXPECT_EQ(0, ViE.codec->GetSendCodec(videoChannel, videoCodec));
videoCodec.width = width;
videoCodec.height = height;
videoCodec.maxFramerate = frameRate;
EXPECT_EQ(0, ViE.codec->SetSendCodec(videoChannel, videoCodec));
EXPECT_EQ(0, ViE.codec->SetReceiveCodec(videoChannel, videoCodec));
}
void TbVideoChannel::StopSend() {
EXPECT_EQ(0, ViE.base->StopSend(videoChannel));
}
void TbVideoChannel::StartReceive(unsigned short rtp_port) {
EXPECT_EQ(0, channel_transport_->SetLocalReceiver(rtp_port));
EXPECT_EQ(0, ViE.base->StartReceive(videoChannel));
}
void TbVideoChannel::StopReceive() {
EXPECT_EQ(0, ViE.base->StopReceive(videoChannel));
}