Removed the engine API:s related to transport such as SetSendDestination, the functionality is now provided via the test frame work.
Review URL: https://webrtc-codereview.appspot.com/1029004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3665 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
2baf5f5fa0
commit
361bac7a4f
@ -15,16 +15,20 @@
|
||||
#include "gflags/gflags.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "voice_engine/include/voe_audio_processing.h"
|
||||
#include "voice_engine/include/voe_base.h"
|
||||
#include "voice_engine/include/voe_codec.h"
|
||||
#include "voice_engine/include/voe_hardware.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/test/udp_transport/include/channel_transport.h"
|
||||
#include "webrtc/voice_engine/include/voe_audio_processing.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(codec, "ISAC", "codec name");
|
||||
DEFINE_int32(rate, 16000, "codec sample rate in Hz");
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
namespace {
|
||||
|
||||
void RunHarness() {
|
||||
@ -38,12 +42,18 @@ void RunHarness() {
|
||||
ASSERT_TRUE(codec != NULL);
|
||||
VoEHardware* hardware = VoEHardware::GetInterface(voe);
|
||||
ASSERT_TRUE(hardware != NULL);
|
||||
VoENetwork* network = VoENetwork::GetInterface(voe);
|
||||
ASSERT_TRUE(network != NULL);
|
||||
|
||||
ASSERT_EQ(0, base->Init());
|
||||
int channel = base->CreateChannel();
|
||||
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};
|
||||
bool codec_found = false;
|
||||
|
@ -13,6 +13,7 @@
|
||||
'target_name': 'audio_e2e_harness',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'<(webrtc_root)/test/udp_transport.gyp:udp_transport',
|
||||
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine_core',
|
||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||
'<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags',
|
||||
|
@ -31,6 +31,7 @@
|
||||
'dependencies': [
|
||||
'webrtc/test/metrics.gyp:*',
|
||||
'webrtc/test/test.gyp:*',
|
||||
'webrtc/test/udp_transport.gyp:*',
|
||||
'webrtc/tools/tools.gyp:*',
|
||||
'tools/e2e_quality/e2e_quality.gyp:*',
|
||||
],
|
||||
|
@ -109,7 +109,6 @@
|
||||
#define WEBRTC_VIDEO_ENGINE_CODEC_API
|
||||
#define WEBRTC_VIDEO_ENGINE_ENCRYPTION_API
|
||||
#define WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
|
||||
#define WEBRTC_VIDEO_ENGINE_NETWORK_API
|
||||
#define WEBRTC_VIDEO_ENGINE_RENDER_API
|
||||
#define WEBRTC_VIDEO_ENGINE_RTP_RTCP_API
|
||||
#define WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
|
||||
|
@ -27,7 +27,6 @@
|
||||
'pacing/pacing.gypi',
|
||||
'remote_bitrate_estimator/remote_bitrate_estimator.gypi',
|
||||
'rtp_rtcp/source/rtp_rtcp.gypi',
|
||||
'udp_transport/source/udp_transport.gypi',
|
||||
'utility/source/utility.gypi',
|
||||
'video_coding/codecs/i420/main/source/i420.gypi',
|
||||
'video_coding/main/source/video_coding.gypi',
|
||||
|
@ -1,4 +0,0 @@
|
||||
pwestin@webrtc.org
|
||||
henrikg@webrtc.org
|
||||
mallinath@webrtc.org
|
||||
tomasl@webrtc.org
|
@ -1,114 +0,0 @@
|
||||
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'udp_transport',
|
||||
'type': 'static_library',
|
||||
'dependencies': [
|
||||
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../interface',
|
||||
'../../interface',
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../interface',
|
||||
'../../interface',
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
# PLATFORM INDEPENDENT SOURCE FILES
|
||||
'../interface/udp_transport.h',
|
||||
'udp_transport_impl.cc',
|
||||
'udp_socket_wrapper.cc',
|
||||
'udp_socket_manager_wrapper.cc',
|
||||
'udp_transport_impl.h',
|
||||
'udp_socket_wrapper.h',
|
||||
'udp_socket_manager_wrapper.h',
|
||||
# PLATFORM SPECIFIC SOURCE FILES - Will be filtered below
|
||||
# Posix (Linux/Mac)
|
||||
'udp_socket_posix.cc',
|
||||
'udp_socket_posix.h',
|
||||
'udp_socket_manager_posix.cc',
|
||||
'udp_socket_manager_posix.h',
|
||||
# Windows
|
||||
'udp_socket2_manager_windows.cc',
|
||||
'udp_socket2_manager_windows.h',
|
||||
'udp_socket2_windows.cc',
|
||||
'udp_socket2_windows.h',
|
||||
'traffic_control_windows.cc',
|
||||
'traffic_control_windows.h',
|
||||
], # source
|
||||
'conditions': [
|
||||
# DEFINE PLATFORM SPECIFIC SOURCE FILES
|
||||
['os_posix==0', {
|
||||
'sources!': [
|
||||
'udp_socket_posix.cc',
|
||||
'udp_socket_posix.h',
|
||||
'udp_socket_manager_posix.cc',
|
||||
'udp_socket_manager_posix.h',
|
||||
],
|
||||
}],
|
||||
['OS!="win"', {
|
||||
'sources!': [
|
||||
'udp_socket2_manager_windows.cc',
|
||||
'udp_socket2_manager_windows.h',
|
||||
'udp_socket2_windows.cc',
|
||||
'udp_socket2_windows.h',
|
||||
'traffic_control_windows.cc',
|
||||
'traffic_control_windows.h',
|
||||
],
|
||||
}],
|
||||
['OS=="linux"', {
|
||||
'cflags': [
|
||||
'-fno-strict-aliasing',
|
||||
],
|
||||
}],
|
||||
['OS=="mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '-fno-strict-aliasing' ],
|
||||
},
|
||||
}],
|
||||
] # conditions
|
||||
},
|
||||
], # targets
|
||||
'conditions': [
|
||||
['include_tests==1', {
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'udp_transport_unittests',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'udp_transport',
|
||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||
'<(DEPTH)/testing/gmock.gyp:gmock',
|
||||
'<(webrtc_root)/test/test.gyp:test_support_main',
|
||||
],
|
||||
'sources': [
|
||||
'udp_transport_unittest.cc',
|
||||
'udp_socket_manager_unittest.cc',
|
||||
'udp_socket_wrapper_unittest.cc',
|
||||
],
|
||||
# Disable warnings to enable Win64 build, issue 1323.
|
||||
'msvs_disabled_warnings': [
|
||||
4267, # size_t to int truncation.
|
||||
],
|
||||
}, # udp_transport_unittests
|
||||
], # targets
|
||||
}], # include_tests
|
||||
], # conditions
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:2
|
||||
# indent-tabs-mode:nil
|
||||
# End:
|
||||
# vim: set expandtab tabstop=2 shiftwidth=2:
|
@ -1,449 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#define Sleep(x) usleep(x*1000)
|
||||
#endif
|
||||
|
||||
#include "udp_transport.h"
|
||||
#include "common_types.h"
|
||||
#include "trace.h"
|
||||
|
||||
//#define QOS_TEST
|
||||
//#define QOS_TEST_WITH_OVERRIDE // require admin on Win7
|
||||
//#define TOS_TEST // require admin on Win7
|
||||
//#define TOS_TEST_USING_SETSOCKOPT
|
||||
//#define PCP_TEST
|
||||
|
||||
class UdpTransportDataA: public UdpTransportData
|
||||
{
|
||||
public:
|
||||
UdpTransportDataA() :
|
||||
_counterRTP(0),
|
||||
_counterRTCP(0)
|
||||
{
|
||||
};
|
||||
virtual void IncomingRTPPacket(const WebRtc_Word8* incommingRtpPacket,
|
||||
const WebRtc_Word32 rtpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort)
|
||||
{
|
||||
_counterRTP++;
|
||||
};
|
||||
|
||||
virtual void IncomingRTCPPacket(const WebRtc_Word8* incommingRtcpPacket,
|
||||
const WebRtc_Word32 rtcpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort)
|
||||
{
|
||||
_counterRTCP++;
|
||||
};
|
||||
WebRtc_UWord32 _counterRTP;
|
||||
WebRtc_UWord32 _counterRTCP;
|
||||
};
|
||||
|
||||
class UdpTransportDataB: public UdpTransportData
|
||||
{
|
||||
public:
|
||||
UdpTransportDataB() :
|
||||
_counterRTP(0),
|
||||
_counterRTCP(0)
|
||||
{
|
||||
};
|
||||
virtual void IncomingRTPPacket(const WebRtc_Word8* incommingRtpPacket,
|
||||
const WebRtc_Word32 rtpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort)
|
||||
{
|
||||
_counterRTP++;
|
||||
};
|
||||
|
||||
virtual void IncomingRTCPPacket(const WebRtc_Word8* incommingRtcpPacket,
|
||||
const WebRtc_Word32 rtcpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort)
|
||||
{
|
||||
_counterRTCP++;
|
||||
};
|
||||
WebRtc_UWord32 _counterRTP;
|
||||
WebRtc_UWord32 _counterRTCP;
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
#else
|
||||
int main(int argc, char* argv[])
|
||||
#endif
|
||||
{
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile("testTrace.txt");
|
||||
Trace::SetEncryptedTraceFile("testTraceDebug.txt");
|
||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||
|
||||
printf("Start UdpTransport test\n");
|
||||
|
||||
WebRtc_UWord8 numberOfSocketThreads = 5;
|
||||
UdpTransport* client1 = UdpTransport::Create(1,numberOfSocketThreads,NULL);
|
||||
numberOfSocketThreads = 0;
|
||||
UdpTransport* client2 = UdpTransport::Create(2,numberOfSocketThreads,NULL);
|
||||
assert(5 == numberOfSocketThreads);
|
||||
|
||||
UdpTransportDataA* client1Callback = new UdpTransportDataA();
|
||||
UdpTransportDataB* client2Callback = new UdpTransportDataB();
|
||||
|
||||
WebRtc_UWord32 localIP = 0;
|
||||
char localIPAddr[64];
|
||||
assert( 0 == client1->LocalHostAddress(localIP)); // network host order aka big-endian
|
||||
|
||||
sprintf(localIPAddr,"%lu.%lu.%lu.%lu",(localIP>>24)& 0x0ff,(localIP>>16)& 0x0ff ,(localIP>>8)& 0x0ff, localIP & 0x0ff);
|
||||
printf("\tLocal IP:%s\n", localIPAddr);
|
||||
|
||||
char localIPV6[16];
|
||||
char localIPAddrV6[128];
|
||||
if( 0 == client1->LocalHostAddressIPV6(localIPV6))
|
||||
{
|
||||
sprintf(localIPAddrV6,"%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x", localIPV6[0],localIPV6[1],localIPV6[2],localIPV6[3],localIPV6[4],localIPV6[5],localIPV6[6],localIPV6[7], localIPV6[8],localIPV6[9],localIPV6[10],localIPV6[11],localIPV6[12],localIPV6[13],localIPV6[14],localIPV6[15]);
|
||||
printf("\tLocal IPV6:%s\n", localIPAddrV6);
|
||||
}
|
||||
|
||||
char test[9] = "testtest";
|
||||
assert( 0 == client1->InitializeReceiveSockets(client1Callback,1234, localIPAddr));
|
||||
|
||||
#if defined QOS_TEST_WITH_OVERRIDE || defined QOS_TEST || defined TOS_TEST || defined TOS_TEST_USING_SETSOCKOPT
|
||||
assert( -1 == client1->SetQoS(true, 3, 1000)); // should fail
|
||||
assert( 0 == client1->InitializeSendSockets("192.168.200.1", 1236,1237));
|
||||
#else
|
||||
assert( 0 == client1->InitializeSendSockets(localIPAddr, 1236,1237));
|
||||
#endif
|
||||
assert( 0 == client1->StartReceiving(20));
|
||||
|
||||
assert( 0 == client2->InitializeReceiveSockets(client2Callback,1236));
|
||||
assert( 0 == client2->InitializeSendSockets(localIPAddr, 1234,1235));
|
||||
assert( 0 == client2->StartReceiving(20));
|
||||
|
||||
Sleep(10);
|
||||
|
||||
#ifdef TOS_TEST
|
||||
// note: you need to have QOS installed on your interface for this test
|
||||
// test by doing a ethereal sniff and filter out packets with ip.dst == 192.168.200.1
|
||||
assert( 0 == client1->SetToS(2));
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
Sleep(10);
|
||||
assert( 0 == client1->SetToS(3));
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
Sleep(10);
|
||||
assert( 0 == client1->SetToS(0));
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
|
||||
printf("Tested TOS \n");
|
||||
Sleep(5000);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#ifdef TOS_TEST_USING_SETSOCKOPT
|
||||
// note: you need to have QOS installed on your interface for this test
|
||||
// test by doing a ethereal sniff and filter out packets with ip.dst == 192.168.200.1
|
||||
assert( 0 == client1->SetToS(2, true));
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
Sleep(10);
|
||||
assert( 0 == client1->SetToS(3, true));
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
Sleep(10);
|
||||
assert( 0 == client1->SetToS(0, true));
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
|
||||
printf("Tested TOS using setsockopt \n");
|
||||
Sleep(5000);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#ifdef QOS_TEST
|
||||
// note: you need to have QOS installed on your interface for this test
|
||||
// test by doing a ethereal sniff and filter out packets with ip.dst == 192.168.200.1
|
||||
assert( 0 == client1->SetQoS(true, 2, 1000)); // SERVICETYPE_CONTROLLEDLOAD 2
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
Sleep(10);
|
||||
assert( 0 == client1->SetQoS(true, 3, 1000)); // SERVICETYPE_GUARANTEED 3
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
Sleep(10);
|
||||
assert( 0 == client1->SetQoS(false, 0)); //
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
|
||||
printf("Tested QOS \n");
|
||||
Sleep(5000);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#ifdef QOS_TEST_WITH_OVERRIDE
|
||||
// note: you need to have QOS installed on your interface for this test
|
||||
// test by doing a ethereal sniff and filter out packets with ip.dst == 192.168.200.1
|
||||
assert( 0 == client1->SetQoS(true, 2, 1000, 1)); // SERVICETYPE_CONTROLLEDLOAD 2
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
Sleep(10);
|
||||
assert( 0 == client1->SetQoS(true, 2, 1000, 2)); // SERVICETYPE_GUARANTEED 3
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
Sleep(10);
|
||||
assert( 0 == client1->SetQoS(false, 0)); //
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
printf("Tested QOS with override \n");
|
||||
Sleep(5000);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#ifdef PCP_TEST
|
||||
// Note: We currently don't know how to test that the bits are actually set in the frame,
|
||||
// this test simply tests the API and that we can send a packet after setting PCP.
|
||||
assert( -1 == client1->SetPCP(-1)); // should fail
|
||||
assert( -1 == client1->SetPCP(8)); // should fail
|
||||
printf("Setting PCP to 7 returned %d \n", client1->SetPCP(7));
|
||||
printf("(Failing is normal, requires the CAP_NET_ADMIN capability to succeed.) \n");
|
||||
Sleep(10);
|
||||
for (int pcp = 6; pcp >= 0; --pcp)
|
||||
{
|
||||
assert( 0 == client1->SetPCP(pcp));
|
||||
Sleep(10);
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
}
|
||||
printf("Tested PCP \n");
|
||||
Sleep(5000);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
Sleep(10);
|
||||
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
|
||||
// test start rec after a socket has revceived data
|
||||
// result: packets received before first startReceive is saved by the OS
|
||||
/*
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
}
|
||||
Sleep(10);
|
||||
assert( 0 == client2->StartReceiving(20));
|
||||
|
||||
// assert( 0 == client2->StopReceiving());
|
||||
|
||||
Sleep(10);
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
}
|
||||
|
||||
assert( 0 == client2->StartReceiving(20));
|
||||
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
}
|
||||
*/
|
||||
Sleep(10);
|
||||
|
||||
assert( 0 == client1Callback->_counterRTP);
|
||||
assert( 1 == client2Callback->_counterRTP);
|
||||
assert( 0 == client1Callback->_counterRTCP);
|
||||
assert( 0 == client2Callback->_counterRTCP);
|
||||
|
||||
printf("Sent 1 packet on one socket \n");
|
||||
|
||||
char ipAddr[64];
|
||||
char tempIpAddr[64];
|
||||
char ipMulticastAddr[64];
|
||||
WebRtc_UWord16 rtpPort = 0;
|
||||
WebRtc_UWord16 rtcpPort = 0;
|
||||
bool reusableSocket = true;
|
||||
assert( 0 == client2->RemoteSocketInformation(ipAddr, rtpPort, rtcpPort));
|
||||
assert( rtpPort == 1234);
|
||||
assert( strncmp(ipAddr, localIPAddr, 16) == 0);
|
||||
|
||||
assert( 0 == client2->ReceiveSocketInformation(ipAddr, rtpPort, rtcpPort, ipMulticastAddr, reusableSocket));
|
||||
assert( rtpPort == 1236);
|
||||
assert( rtcpPort == 1237);
|
||||
assert( strncmp(ipAddr, "0.0.0.0", 16) == 0);
|
||||
assert( ipMulticastAddr[0] == 0);
|
||||
assert( reusableSocket == false);
|
||||
|
||||
assert( 0 == client2->SendSocketInformation(ipAddr, rtpPort, rtcpPort));
|
||||
assert( rtpPort == 1234);
|
||||
assert( rtcpPort == 1235);
|
||||
assert( strncmp(ipAddr,localIPAddr, 16) == 0);
|
||||
|
||||
const int numberOfPackets = 1000;
|
||||
int n = 0;
|
||||
while(n < numberOfPackets)
|
||||
{
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
assert( 9 == client2->SendPacket(-1, test, 9));
|
||||
assert( 9 == client1->SendRTCPPacket(-1, test, 9));
|
||||
assert( 9 == client2->SendRTCPPacket(-1, test, 9));
|
||||
n++;
|
||||
}
|
||||
int loops = 0;
|
||||
for(; loops < 100 &&
|
||||
!(client1Callback->_counterRTP == numberOfPackets &&
|
||||
client1Callback->_counterRTCP == numberOfPackets &&
|
||||
client2Callback->_counterRTP == numberOfPackets+1 &&
|
||||
client2Callback->_counterRTCP == numberOfPackets);
|
||||
loops++)
|
||||
{
|
||||
Sleep(10);
|
||||
}
|
||||
printf("\tSent %d packets on 4 sockets in:%d ms\n", numberOfPackets, loops*10);
|
||||
|
||||
assert( numberOfPackets == client1Callback->_counterRTP);
|
||||
assert( numberOfPackets+1 == client2Callback->_counterRTP);
|
||||
assert( numberOfPackets == client1Callback->_counterRTCP);
|
||||
assert( numberOfPackets == client2Callback->_counterRTCP);
|
||||
|
||||
assert( 0 == client1->StopReceiving());
|
||||
assert( 0 == client2->StopReceiving());
|
||||
|
||||
printf("Tear down client 2\n");
|
||||
|
||||
// configure that fail
|
||||
assert( -1 == client2->InitializeReceiveSockets(client2Callback,1234, localIPAddr)); // port in use
|
||||
assert( !client2->ReceiveSocketsInitialized());
|
||||
assert( 0 == client2->InitializeReceiveSockets(client2Callback,1236));
|
||||
assert( 0 == client2->StartReceiving(20));
|
||||
|
||||
printf("Client 2 re-configured\n");
|
||||
|
||||
assert( client1->SendSocketsInitialized());
|
||||
assert( client1->ReceiveSocketsInitialized());
|
||||
assert( client2->SendSocketsInitialized());
|
||||
assert( client2->ReceiveSocketsInitialized());
|
||||
|
||||
assert( 9 == client1->SendPacket(-1, test, 9));
|
||||
|
||||
// this should not be received since we dont receive in client 1
|
||||
assert( 9 == client2->SendPacket(-1, test, 9));
|
||||
|
||||
Sleep(10);
|
||||
|
||||
assert( numberOfPackets == client1Callback->_counterRTP);
|
||||
assert( numberOfPackets+2 == client2Callback->_counterRTP);
|
||||
assert( numberOfPackets == client1Callback->_counterRTCP);
|
||||
assert( numberOfPackets == client2Callback->_counterRTCP);
|
||||
printf("\tSent 1 packet on one socket \n");
|
||||
|
||||
printf("Start filter test\n");
|
||||
|
||||
assert( 0 == client1->StartReceiving(20));
|
||||
|
||||
assert( 0 == client1->SetFilterPorts(1234, 1235)); // should filter out what we send
|
||||
assert( 0 == client1->SetFilterIP(localIPAddr));
|
||||
|
||||
assert( 0 == client1->FilterIP(tempIpAddr));
|
||||
assert( strncmp(tempIpAddr, localIPAddr, 16) == 0);
|
||||
|
||||
assert( 9 == client2->SendPacket(-1, test, 9));
|
||||
assert( 9 == client2->SendRTCPPacket(-1, test, 9));
|
||||
|
||||
Sleep(10);
|
||||
|
||||
assert( numberOfPackets == client1Callback->_counterRTP);
|
||||
assert( numberOfPackets+2 == client2Callback->_counterRTP);
|
||||
assert( numberOfPackets == client1Callback->_counterRTCP);
|
||||
assert( numberOfPackets == client2Callback->_counterRTCP);
|
||||
|
||||
assert( 0 == client1->SetFilterPorts(1236, 1237)); // should pass through
|
||||
|
||||
assert( 9 == client2->SendPacket(-1, test, 9));
|
||||
assert( 9 == client2->SendRTCPPacket(-1, test, 9));
|
||||
printf("\tSent 1 packet on two sockets \n");
|
||||
|
||||
Sleep(10);
|
||||
|
||||
assert( numberOfPackets+1 == client1Callback->_counterRTP);
|
||||
assert( numberOfPackets+2 == client2Callback->_counterRTP);
|
||||
assert( numberOfPackets+1 == client1Callback->_counterRTCP);
|
||||
assert( numberOfPackets == client2Callback->_counterRTCP);
|
||||
|
||||
assert( 0 == client1->SetFilterIP("127.0.0.2"));
|
||||
|
||||
assert( 9 == client2->SendPacket(-1, test, 9));
|
||||
assert( 9 == client2->SendRTCPPacket(-1, test, 9));
|
||||
printf("\tSent 1 packet on two sockets \n");
|
||||
|
||||
Sleep(10);
|
||||
|
||||
assert( numberOfPackets+1 == client1Callback->_counterRTP);
|
||||
assert( numberOfPackets+2 == client2Callback->_counterRTP);
|
||||
assert( numberOfPackets+1 == client1Callback->_counterRTCP);
|
||||
assert( numberOfPackets == client2Callback->_counterRTCP);
|
||||
|
||||
assert( 0 == client1->SetFilterIP(NULL));
|
||||
assert( 0 == client1->SetFilterPorts(0, 0));
|
||||
|
||||
printf("Tested filter \n");
|
||||
|
||||
assert( 0 == client2->InitializeSourcePorts(1238, 1239));
|
||||
assert( 9 == client2->SendPacket(-1, test, 9));
|
||||
assert( 9 == client2->SendRTCPPacket(-1, test, 9));
|
||||
printf("\tSent 1 packet on two sockets \n");
|
||||
|
||||
Sleep(10);
|
||||
|
||||
assert( numberOfPackets+2 == client1Callback->_counterRTP);
|
||||
assert( numberOfPackets+2 == client2Callback->_counterRTP);
|
||||
assert( numberOfPackets+2 == client1Callback->_counterRTCP);
|
||||
assert( numberOfPackets == client2Callback->_counterRTCP);
|
||||
|
||||
assert( 0 == client1->RemoteSocketInformation(ipAddr, rtpPort, rtcpPort));
|
||||
assert( rtpPort == 1238);
|
||||
assert( rtcpPort == 1239);
|
||||
assert( strncmp(ipAddr, localIPAddr, 16) == 0);
|
||||
|
||||
printf("Tested source port \n");
|
||||
|
||||
assert( 0 == client2->InitializeSourcePorts(1240 ));
|
||||
assert( 9 == client2->SendPacket(-1, test, 9));
|
||||
assert( 9 == client2->SendRTCPPacket(-1, test, 9));
|
||||
printf("\tSent 1 packet on two sockets \n");
|
||||
|
||||
Sleep(10);
|
||||
|
||||
assert( 0 == client1->RemoteSocketInformation(ipAddr, rtpPort, rtcpPort));
|
||||
assert( rtpPort == 1240);
|
||||
assert( rtcpPort == 1241);
|
||||
|
||||
printf("Tested SetSendPorts source port \n");
|
||||
|
||||
UdpTransport::Destroy(client1);
|
||||
UdpTransport::Destroy(client2);
|
||||
|
||||
printf("\n\nUdpTransport test done\n");
|
||||
|
||||
delete client1Callback;
|
||||
delete client2Callback;
|
||||
|
||||
Sleep(5000);
|
||||
Trace::ReturnTrace();
|
||||
};
|
71
webrtc/test/udp_transport.gyp
Normal file
71
webrtc/test/udp_transport.gyp
Normal file
@ -0,0 +1,71 @@
|
||||
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
{
|
||||
'includes': [
|
||||
'../build/common.gypi',
|
||||
],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'udp_transport',
|
||||
'type': 'static_library',
|
||||
'dependencies': [
|
||||
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'udp_transport/include',
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
# PLATFORM INDEPENDENT SOURCE FILES
|
||||
'udp_transport/channel_transport.cc',
|
||||
'udp_transport/include/channel_transport.h',
|
||||
'udp_transport/udp_transport.h',
|
||||
'udp_transport/udp_transport_impl.cc',
|
||||
'udp_transport/udp_socket_wrapper.cc',
|
||||
'udp_transport/udp_socket_manager_wrapper.cc',
|
||||
'udp_transport/udp_transport_impl.h',
|
||||
'udp_transport/udp_socket_wrapper.h',
|
||||
'udp_transport/udp_socket_manager_wrapper.h',
|
||||
# PLATFORM SPECIFIC SOURCE FILES - Will be filtered below
|
||||
# Posix (Linux/Mac)
|
||||
'udp_transport/udp_socket_posix.cc',
|
||||
'udp_transport/udp_socket_posix.h',
|
||||
'udp_transport/udp_socket_manager_posix.cc',
|
||||
'udp_transport/udp_socket_manager_posix.h',
|
||||
# win
|
||||
'udp_transport/udp_socket2_manager_win.cc',
|
||||
'udp_transport/udp_socket2_manager_win.h',
|
||||
'udp_transport/udp_socket2_win.cc',
|
||||
'udp_transport/udp_socket2_win.h',
|
||||
'udp_transport/traffic_control_win.cc',
|
||||
'udp_transport/traffic_control_win.h',
|
||||
], # source
|
||||
},
|
||||
{
|
||||
'target_name': 'udp_transport_unittests',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'udp_transport',
|
||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||
'<(DEPTH)/testing/gmock.gyp:gmock',
|
||||
'<(webrtc_root)/test/test.gyp:test_support_main',
|
||||
],
|
||||
'sources': [
|
||||
'udp_transport/udp_transport_unittest.cc',
|
||||
'udp_transport/udp_socket_manager_unittest.cc',
|
||||
'udp_transport/udp_socket_wrapper_unittest.cc',
|
||||
],
|
||||
# Disable warnings to enable Win64 build, issue 1323.
|
||||
'msvs_disabled_warnings': [
|
||||
4267, # size_t to int truncation.
|
||||
],
|
||||
}, # udp_transport_unittests
|
||||
], # targets
|
||||
}
|
100
webrtc/test/udp_transport/channel_transport.cc
Normal file
100
webrtc/test/udp_transport/channel_transport.cc
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/test/udp_transport/include/channel_transport.h"
|
||||
|
||||
#include "webrtc/test/udp_transport/udp_transport.h"
|
||||
#include "webrtc/video_engine/include/vie_network.h"
|
||||
#include "webrtc/voice_engine/include/voe_network.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
VoiceChannelTransport::VoiceChannelTransport(VoENetwork* voe_network,
|
||||
int channel)
|
||||
: channel_(channel),
|
||||
voe_network_(voe_network) {
|
||||
WebRtc_UWord8 socket_threads = 1;
|
||||
socket_transport_ = UdpTransport::Create(channel, socket_threads);
|
||||
voe_network_->RegisterExternalTransport(channel, *socket_transport_);
|
||||
}
|
||||
|
||||
VoiceChannelTransport::~VoiceChannelTransport() {
|
||||
voe_network_->DeRegisterExternalTransport(channel_);
|
||||
UdpTransport::Destroy(socket_transport_);
|
||||
}
|
||||
|
||||
void VoiceChannelTransport::IncomingRTPPacket(
|
||||
const WebRtc_Word8* incoming_rtp_packet,
|
||||
const WebRtc_Word32 packet_length,
|
||||
const char* /*from_ip*/,
|
||||
const WebRtc_UWord16 /*from_port*/) {
|
||||
voe_network_->ReceivedRTPPacket(channel_, incoming_rtp_packet, packet_length);
|
||||
}
|
||||
|
||||
void VoiceChannelTransport::IncomingRTCPPacket(
|
||||
const WebRtc_Word8* incoming_rtcp_packet,
|
||||
const WebRtc_Word32 packet_length,
|
||||
const char* /*from_ip*/,
|
||||
const WebRtc_UWord16 /*from_port*/) {
|
||||
voe_network_->ReceivedRTCPPacket(channel_, incoming_rtcp_packet,
|
||||
packet_length);
|
||||
}
|
||||
|
||||
int VoiceChannelTransport::SetLocalReceiver(WebRtc_UWord16 rtp_port) {
|
||||
return socket_transport_->InitializeReceiveSockets(this, rtp_port);
|
||||
}
|
||||
|
||||
int VoiceChannelTransport::SetSendDestination(const char* ip_address,
|
||||
WebRtc_UWord16 rtp_port) {
|
||||
return socket_transport_->InitializeSendSockets(ip_address, rtp_port);
|
||||
}
|
||||
|
||||
|
||||
VideoChannelTransport::VideoChannelTransport(ViENetwork* vie_network,
|
||||
int channel)
|
||||
: channel_(channel),
|
||||
vie_network_(vie_network) {
|
||||
WebRtc_UWord8 socket_threads = 1;
|
||||
socket_transport_ = UdpTransport::Create(channel, socket_threads);
|
||||
vie_network_->RegisterSendTransport(channel, *socket_transport_);
|
||||
}
|
||||
|
||||
VideoChannelTransport::~VideoChannelTransport() {
|
||||
vie_network_->DeregisterSendTransport(channel_);
|
||||
UdpTransport::Destroy(socket_transport_);
|
||||
}
|
||||
|
||||
void VideoChannelTransport::IncomingRTPPacket(
|
||||
const WebRtc_Word8* incoming_rtp_packet,
|
||||
const WebRtc_Word32 packet_length,
|
||||
const char* /*from_ip*/,
|
||||
const WebRtc_UWord16 /*from_port*/) {
|
||||
vie_network_->ReceivedRTPPacket(channel_, incoming_rtp_packet, packet_length);
|
||||
}
|
||||
|
||||
void VideoChannelTransport::IncomingRTCPPacket(
|
||||
const WebRtc_Word8* incoming_rtcp_packet,
|
||||
const WebRtc_Word32 packet_length,
|
||||
const char* /*from_ip*/,
|
||||
const WebRtc_UWord16 /*from_port*/) {
|
||||
vie_network_->ReceivedRTCPPacket(channel_, incoming_rtcp_packet,
|
||||
packet_length);
|
||||
}
|
||||
|
||||
int VideoChannelTransport::SetLocalReceiver(WebRtc_UWord16 rtp_port) {
|
||||
return socket_transport_->InitializeReceiveSockets(this, rtp_port);
|
||||
}
|
||||
|
||||
int VideoChannelTransport::SetSendDestination(const char* ip_address,
|
||||
WebRtc_UWord16 rtp_port) {
|
||||
return socket_transport_->InitializeSendSockets(ip_address, rtp_port);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
86
webrtc/test/udp_transport/include/channel_transport.h
Normal file
86
webrtc/test/udp_transport/include/channel_transport.h
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_TEST_UDP_TRANSPORT_INTERFACE_CHANNEL_TRANSPORT_H_
|
||||
#define WEBRTC_TEST_UDP_TRANSPORT_INTERFACE_CHANNEL_TRANSPORT_H_
|
||||
|
||||
#include "webrtc/test/udp_transport/udp_transport.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class ViENetwork;
|
||||
class VoENetwork;
|
||||
|
||||
// Helper class for VoiceEngine tests.
|
||||
class VoiceChannelTransport : public UdpTransportData {
|
||||
public:
|
||||
VoiceChannelTransport(VoENetwork* voe_network, int channel);
|
||||
|
||||
virtual ~VoiceChannelTransport();
|
||||
|
||||
// Start implementation of UdpTransportData.
|
||||
void IncomingRTPPacket(const WebRtc_Word8* incoming_rtp_packet,
|
||||
const WebRtc_Word32 packet_length,
|
||||
const char* /*from_ip*/,
|
||||
const WebRtc_UWord16 /*from_port*/);
|
||||
|
||||
void IncomingRTCPPacket(const WebRtc_Word8* incoming_rtcp_packet,
|
||||
const WebRtc_Word32 packet_length,
|
||||
const char* /*from_ip*/,
|
||||
const WebRtc_UWord16 /*from_port*/);
|
||||
// End implementation of UdpTransportData.
|
||||
|
||||
// Specifies the ports to receive RTP packets on.
|
||||
int SetLocalReceiver(WebRtc_UWord16 rtp_port);
|
||||
|
||||
// Specifies the destination port and IP address for a specified channel.
|
||||
int SetSendDestination(const char* ip_address, WebRtc_UWord16 rtp_port);
|
||||
|
||||
private:
|
||||
int channel_;
|
||||
VoENetwork* voe_network_;
|
||||
UdpTransport* socket_transport_;
|
||||
};
|
||||
|
||||
// Helper class for VideoEngine tests.
|
||||
class VideoChannelTransport : public UdpTransportData {
|
||||
public:
|
||||
VideoChannelTransport(ViENetwork* vie_network, int channel);
|
||||
|
||||
virtual ~VideoChannelTransport();
|
||||
|
||||
// Start implementation of UdpTransportData.
|
||||
void IncomingRTPPacket(const WebRtc_Word8* incoming_rtp_packet,
|
||||
const WebRtc_Word32 packet_length,
|
||||
const char* /*from_ip*/,
|
||||
const WebRtc_UWord16 /*from_port*/);
|
||||
|
||||
void IncomingRTCPPacket(const WebRtc_Word8* incoming_rtcp_packet,
|
||||
const WebRtc_Word32 packet_length,
|
||||
const char* /*from_ip*/,
|
||||
const WebRtc_UWord16 /*from_port*/);
|
||||
// End implementation of UdpTransportData.
|
||||
|
||||
// Specifies the ports to receive RTP packets on.
|
||||
int SetLocalReceiver(WebRtc_UWord16 rtp_port);
|
||||
|
||||
// Specifies the destination port and IP address for a specified channel.
|
||||
int SetSendDestination(const char* ip_address, WebRtc_UWord16 rtp_port);
|
||||
|
||||
private:
|
||||
int channel_;
|
||||
ViENetwork* vie_network_;
|
||||
UdpTransport* socket_transport_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_TEST_UDP_TRANSPORT_INTERFACE_CHANNEL_TRANSPORT_H_
|
||||
|
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "traffic_control_windows.h"
|
||||
#include "traffic_control_win.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -8,13 +8,13 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "udp_socket2_manager_windows.h"
|
||||
#include "udp_socket2_manager_win.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "aligned_malloc.h"
|
||||
#include "udp_socket2_windows.h"
|
||||
#include "udp_socket2_win.h"
|
||||
|
||||
namespace webrtc {
|
||||
WebRtc_UWord32 UdpSocket2ManagerWindows::_numOfActiveManagers = 0;
|
@ -22,7 +22,7 @@
|
||||
#include "event_wrapper.h"
|
||||
#include "list_wrapper.h"
|
||||
#include "thread_wrapper.h"
|
||||
#include "udp_socket2_windows.h"
|
||||
#include "udp_socket2_win.h"
|
||||
#include "udp_socket_manager_wrapper.h"
|
||||
|
||||
#define MAX_IO_BUFF_SIZE 1600
|
@ -8,14 +8,14 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "udp_socket2_windows.h"
|
||||
#include "udp_socket2_win.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
#include "traffic_control_windows.h"
|
||||
#include "udp_socket2_manager_windows.h"
|
||||
#include "traffic_control_win.h"
|
||||
#include "udp_socket2_manager_win.h"
|
||||
|
||||
#pragma warning(disable : 4311)
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "rw_lock_wrapper.h"
|
||||
#include "trace.h"
|
||||
#include "udp_socket_wrapper.h"
|
||||
#include "udp_socket2_manager_windows.h"
|
||||
#include "udp_socket2_manager_win.h"
|
||||
|
||||
namespace webrtc {
|
||||
class UdpSocket2ManagerWindows;
|
@ -14,7 +14,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "fix_interlocked_exchange_pointer_win.h"
|
||||
#include "udp_socket2_manager_windows.h"
|
||||
#include "udp_socket2_manager_win.h"
|
||||
#else
|
||||
#include "udp_socket_manager_posix.h"
|
||||
#endif
|
@ -18,7 +18,7 @@
|
||||
#include "udp_socket_manager_wrapper.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "udp_socket2_windows.h"
|
||||
#include "udp_socket2_win.h"
|
||||
#else
|
||||
#include "udp_socket_posix.h"
|
||||
#endif
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "modules/udp_transport/source/udp_socket_wrapper.h"
|
||||
#include "modules/udp_transport/source/udp_socket_manager_wrapper.h"
|
||||
#include "webrtc/test/udp_transport/udp_socket_wrapper.h"
|
||||
#include "webrtc/test/udp_transport/udp_socket_manager_wrapper.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::Return;
|
@ -8,12 +8,11 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_UDP_TRANSPORT_INTERFACE_UDP_TRANSPORT_H_
|
||||
#define WEBRTC_MODULES_UDP_TRANSPORT_INTERFACE_UDP_TRANSPORT_H_
|
||||
#ifndef WEBRTC_TEST_UDP_TRANSPORT_INTERFACE_UDP_TRANSPORT_H_
|
||||
#define WEBRTC_TEST_UDP_TRANSPORT_INTERFACE_UDP_TRANSPORT_H_
|
||||
|
||||
#include "common_types.h"
|
||||
#include "module.h"
|
||||
#include "typedefs.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
/*
|
||||
* WARNING
|
||||
@ -22,7 +21,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define SS_MAXSIZE 128
|
||||
#define SS_ALIGNSIZE (sizeof (WebRtc_UWord64))
|
||||
#define SS_PAD1SIZE (SS_ALIGNSIZE - sizeof(WebRtc_Word16))
|
||||
@ -31,94 +29,84 @@
|
||||
|
||||
// BSD requires use of HAVE_STRUCT_SOCKADDR_SA_LEN
|
||||
namespace webrtc {
|
||||
struct SocketAddressIn
|
||||
{
|
||||
// sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6)
|
||||
struct SocketAddressIn {
|
||||
// sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6)
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
|
||||
WebRtc_Word8 sin_length;
|
||||
WebRtc_Word8 sin_family;
|
||||
WebRtc_Word8 sin_length;
|
||||
WebRtc_Word8 sin_family;
|
||||
#else
|
||||
WebRtc_Word16 sin_family;
|
||||
WebRtc_Word16 sin_family;
|
||||
#endif
|
||||
WebRtc_UWord16 sin_port;
|
||||
WebRtc_UWord32 sin_addr;
|
||||
WebRtc_Word8 sin_zero[8];
|
||||
WebRtc_UWord16 sin_port;
|
||||
WebRtc_UWord32 sin_addr;
|
||||
WebRtc_Word8 sin_zero[8];
|
||||
};
|
||||
|
||||
struct Version6InAddress
|
||||
{
|
||||
union
|
||||
{
|
||||
WebRtc_UWord8 _s6_u8[16];
|
||||
WebRtc_UWord32 _s6_u32[4];
|
||||
WebRtc_UWord64 _s6_u64[2];
|
||||
} Version6AddressUnion;
|
||||
struct Version6InAddress {
|
||||
union {
|
||||
WebRtc_UWord8 _s6_u8[16];
|
||||
WebRtc_UWord32 _s6_u32[4];
|
||||
WebRtc_UWord64 _s6_u64[2];
|
||||
} Version6AddressUnion;
|
||||
};
|
||||
|
||||
struct SocketAddressInVersion6
|
||||
{
|
||||
// sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6)
|
||||
struct SocketAddressInVersion6 {
|
||||
// sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6)
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
|
||||
WebRtc_Word8 sin_length;
|
||||
WebRtc_Word8 sin_family;
|
||||
WebRtc_Word8 sin_length;
|
||||
WebRtc_Word8 sin_family;
|
||||
#else
|
||||
WebRtc_Word16 sin_family;
|
||||
WebRtc_Word16 sin_family;
|
||||
#endif
|
||||
// Transport layer port number.
|
||||
WebRtc_UWord16 sin6_port;
|
||||
// IPv6 traffic class and flow info or ip4 address.
|
||||
WebRtc_UWord32 sin6_flowinfo;
|
||||
// IPv6 address
|
||||
struct Version6InAddress sin6_addr;
|
||||
// Set of interfaces for a scope.
|
||||
WebRtc_UWord32 sin6_scope_id;
|
||||
// Transport layer port number.
|
||||
WebRtc_UWord16 sin6_port;
|
||||
// IPv6 traffic class and flow info or ip4 address.
|
||||
WebRtc_UWord32 sin6_flowinfo;
|
||||
// IPv6 address
|
||||
struct Version6InAddress sin6_addr;
|
||||
// Set of interfaces for a scope.
|
||||
WebRtc_UWord32 sin6_scope_id;
|
||||
};
|
||||
|
||||
struct SocketAddressStorage
|
||||
{
|
||||
// sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6)
|
||||
struct SocketAddressStorage {
|
||||
// sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6)
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
|
||||
WebRtc_Word8 sin_length;
|
||||
WebRtc_Word8 sin_family;
|
||||
WebRtc_Word8 sin_length;
|
||||
WebRtc_Word8 sin_family;
|
||||
#else
|
||||
WebRtc_Word16 sin_family;
|
||||
WebRtc_Word16 sin_family;
|
||||
#endif
|
||||
WebRtc_Word8 __ss_pad1[SS_PAD1SIZE];
|
||||
WebRtc_UWord64 __ss_align;
|
||||
WebRtc_Word8 __ss_pad2[SS_PAD2SIZE];
|
||||
WebRtc_Word8 __ss_pad1[SS_PAD1SIZE];
|
||||
WebRtc_UWord64 __ss_align;
|
||||
WebRtc_Word8 __ss_pad2[SS_PAD2SIZE];
|
||||
};
|
||||
|
||||
struct SocketAddress
|
||||
{
|
||||
union
|
||||
{
|
||||
struct SocketAddressIn _sockaddr_in;
|
||||
struct SocketAddressInVersion6 _sockaddr_in6;
|
||||
struct SocketAddressStorage _sockaddr_storage;
|
||||
};
|
||||
struct SocketAddress {
|
||||
union {
|
||||
struct SocketAddressIn _sockaddr_in;
|
||||
struct SocketAddressInVersion6 _sockaddr_in6;
|
||||
struct SocketAddressStorage _sockaddr_storage;
|
||||
};
|
||||
};
|
||||
|
||||
// Callback class that receives packets from UdpTransport.
|
||||
class UdpTransportData
|
||||
{
|
||||
public:
|
||||
virtual ~UdpTransportData() {};
|
||||
class UdpTransportData {
|
||||
public:
|
||||
virtual ~UdpTransportData() {};
|
||||
|
||||
virtual void IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket,
|
||||
const WebRtc_Word32 rtpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort) = 0;
|
||||
virtual void IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket,
|
||||
const WebRtc_Word32 rtpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort) = 0;
|
||||
|
||||
virtual void IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket,
|
||||
const WebRtc_Word32 rtcpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort) = 0;
|
||||
virtual void IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket,
|
||||
const WebRtc_Word32 rtcpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort) = 0;
|
||||
};
|
||||
|
||||
|
||||
class UdpTransport : public Module, public Transport
|
||||
{
|
||||
public:
|
||||
class UdpTransport : public Transport {
|
||||
public:
|
||||
enum
|
||||
{
|
||||
kIpAddressVersion6Length = 64,
|
||||
@ -389,6 +377,7 @@ public:
|
||||
// is interptreted as IPv6.
|
||||
static bool IsIpAddressValid(const char* ipaddr, const bool ipV6);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_UDP_TRANSPORT_INTERFACE_UDP_TRANSPORT_H_
|
||||
#endif // WEBRTC_TEST_UDP_TRANSPORT_INTERFACE_UDP_TRANSPORT_H_
|
@ -179,44 +179,6 @@ UdpTransportImpl::~UdpTransportImpl()
|
||||
__FUNCTION__);
|
||||
}
|
||||
|
||||
WebRtc_Word32 UdpTransportImpl::ChangeUniqueId(const WebRtc_Word32 id)
|
||||
{
|
||||
|
||||
CriticalSectionScoped cs(_crit);
|
||||
_id = id;
|
||||
if(_mgr)
|
||||
{
|
||||
_mgr->ChangeUniqueId(id);
|
||||
}
|
||||
if(_ptrRtpSocket)
|
||||
{
|
||||
_ptrRtpSocket->ChangeUniqueId(id);
|
||||
}
|
||||
if(_ptrRtcpSocket)
|
||||
{
|
||||
_ptrRtcpSocket->ChangeUniqueId(id);
|
||||
}
|
||||
if(_ptrSendRtpSocket)
|
||||
{
|
||||
_ptrSendRtpSocket->ChangeUniqueId(id);
|
||||
}
|
||||
if(_ptrSendRtcpSocket)
|
||||
{
|
||||
_ptrSendRtcpSocket->ChangeUniqueId(id);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 UdpTransportImpl::TimeUntilNextProcess()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
WebRtc_Word32 UdpTransportImpl::Process()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
UdpTransport::ErrorCode UdpTransportImpl::LastError() const
|
||||
{
|
||||
return _lastError;
|
||||
@ -1398,7 +1360,7 @@ UdpTransportImpl::ErrorCode UdpTransportImpl::BindLocalRTPSocket()
|
||||
{
|
||||
SocketAddress stLclName;
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
|
||||
stLclName.sin_length = 0;
|
||||
stLclName.sin_lenght = 0;
|
||||
stLclName.sin_family = PF_INET6;
|
||||
#else
|
||||
stLclName._sockaddr_storage.sin_family = PF_INET6;
|
||||
@ -2561,7 +2523,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16])
|
||||
req.r.ifa_family = AF_INET6;
|
||||
|
||||
// Fill up all the attributes for the rtnetlink header.
|
||||
// The length is very important. 16 signifies the ipv6 address.
|
||||
// The lenght is very important. 16 signifies the ipv6 address.
|
||||
rta = (struct rtattr*)(((char*)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
|
||||
rta->rta_len = RTA_LENGTH(16);
|
||||
|
@ -42,11 +42,6 @@ public:
|
||||
UdpSocketManager* socket_manager);
|
||||
virtual ~UdpTransportImpl();
|
||||
|
||||
// Module functions
|
||||
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
|
||||
virtual WebRtc_Word32 TimeUntilNextProcess();
|
||||
virtual WebRtc_Word32 Process();
|
||||
|
||||
// UdpTransport functions
|
||||
virtual WebRtc_Word32 InitializeSendSockets(
|
||||
const char* ipAddr,
|
@ -10,14 +10,14 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "udp_transport.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "webrtc/test/udp_transport/udp_transport.h"
|
||||
// We include the implementation header file to get at the dependency-injecting
|
||||
// constructor.
|
||||
#include "udp_transport_impl.h"
|
||||
#include "webrtc/test/udp_transport/udp_transport_impl.h"
|
||||
// We must mock the socket manager, for which we need its definition.
|
||||
#include "udp_socket_manager_wrapper.h"
|
||||
#include "webrtc/test/udp_transport/udp_socket_manager_wrapper.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::Return;
|
@ -65,34 +65,6 @@ class WEBRTC_DLLEXPORT ViENetwork {
|
||||
// for all sub-API:s before the VideoEngine object can be safely deleted.
|
||||
virtual int Release() = 0;
|
||||
|
||||
// Specifies the ports to receive RTP packets on. It is also possible to set
|
||||
// port for RTCP and local IP address.
|
||||
virtual int SetLocalReceiver(const int video_channel,
|
||||
const unsigned short rtp_port,
|
||||
const unsigned short rtcp_port = 0,
|
||||
const char* ip_address = NULL) = 0;
|
||||
|
||||
// Gets the local receiver ports and address for a specified channel.
|
||||
virtual int GetLocalReceiver(const int video_channel,
|
||||
unsigned short& rtp_port,
|
||||
unsigned short& rtcp_port, char* ip_address) = 0;
|
||||
|
||||
// Specifies the destination port and IP address for a specified channel.
|
||||
virtual int SetSendDestination(const int video_channel,
|
||||
const char* ip_address,
|
||||
const unsigned short rtp_port,
|
||||
const unsigned short rtcp_port = 0,
|
||||
const unsigned short source_rtp_port = 0,
|
||||
const unsigned short source_rtcp_port = 0) = 0;
|
||||
|
||||
// Get the destination port and address for a specified channel.
|
||||
virtual int GetSendDestination(const int video_channel,
|
||||
char* ip_address,
|
||||
unsigned short& rtp_port,
|
||||
unsigned short& rtcp_port,
|
||||
unsigned short& source_rtp_port,
|
||||
unsigned short& source_rtcp_port) = 0;
|
||||
|
||||
// This function registers a user implementation of Transport to use for
|
||||
// sending RTP and RTCP packets on this channel.
|
||||
virtual int RegisterSendTransport(const int video_channel,
|
||||
@ -114,63 +86,6 @@ class WEBRTC_DLLEXPORT ViENetwork {
|
||||
const void* data,
|
||||
const int length) = 0;
|
||||
|
||||
// Gets the source ports and IP address of the incoming stream for a
|
||||
// specified channel.
|
||||
virtual int GetSourceInfo(const int video_channel,
|
||||
unsigned short& rtp_port,
|
||||
unsigned short& rtcp_port,
|
||||
char* ip_address,
|
||||
unsigned int ip_address_length) = 0;
|
||||
|
||||
// Gets the local IP address, in string format.
|
||||
virtual int GetLocalIP(char ip_address[64], bool ipv6 = false) = 0;
|
||||
|
||||
// Enables IPv6, instead of IPv4, for a specified channel.
|
||||
virtual int EnableIPv6(int video_channel) = 0;
|
||||
|
||||
// The function returns true if IPv6 is enabled, false otherwise.
|
||||
virtual bool IsIPv6Enabled(int video_channel) = 0;
|
||||
|
||||
// Enables a port and IP address filtering for incoming packets on a
|
||||
// specific channel.
|
||||
virtual int SetSourceFilter(const int video_channel,
|
||||
const unsigned short rtp_port,
|
||||
const unsigned short rtcp_port = 0,
|
||||
const char* ip_address = NULL) = 0;
|
||||
|
||||
// Gets current port and IP address filter for a specified channel.
|
||||
virtual int GetSourceFilter(const int video_channel,
|
||||
unsigned short& rtp_port,
|
||||
unsigned short& rtcp_port,
|
||||
char* ip_address) = 0;
|
||||
|
||||
// This function sets the six‐bit Differentiated Services Code Point (DSCP)
|
||||
// in the IP header of the outgoing stream for a specific channel.
|
||||
// Windows and Linux only.
|
||||
virtual int SetSendToS(const int video_channel,
|
||||
const int DSCP,
|
||||
const bool use_set_sockOpt = false) = 0;
|
||||
|
||||
// Retrieves the six‐bit Differentiated Services Code Point (DSCP) in the IP
|
||||
// header of the outgoing stream for a specific channel.
|
||||
virtual int GetSendToS(const int video_channel,
|
||||
int& DSCP,
|
||||
bool& use_set_sockOpt) = 0;
|
||||
|
||||
// This function sets the Generic Quality of Service (GQoS) service level.
|
||||
// The Windows operating system then maps to a Differentiated Services Code
|
||||
// Point (DSCP) and to an 802.1p setting. Windows only.
|
||||
virtual int SetSendGQoS(const int video_channel, const bool enable,
|
||||
const int service_type,
|
||||
const int overrideDSCP = 0) = 0;
|
||||
|
||||
// This function retrieves the currently set GQoS service level for a
|
||||
// specific channel.
|
||||
virtual int GetSendGQoS(const int video_channel,
|
||||
bool& enabled,
|
||||
int& service_type,
|
||||
int& overrideDSCP) = 0;
|
||||
|
||||
// This function sets the Maximum Transition Unit (MTU) for a channel. The
|
||||
// RTP packet will be packetized based on this MTU to optimize performance
|
||||
// over the network.
|
||||
@ -197,14 +112,6 @@ class WEBRTC_DLLEXPORT ViENetwork {
|
||||
const bool enable,
|
||||
const unsigned int sample_time_seconds = KDefaultSampleTimeSeconds) = 0;
|
||||
|
||||
// This function handles sending a raw UDP data packet over an existing RTP
|
||||
// or RTCP socket.
|
||||
virtual int SendUDPPacket(const int video_channel,
|
||||
const void* data,
|
||||
const unsigned int length,
|
||||
int& transmitted_bytes,
|
||||
bool use_rtcp_socket = false) = 0;
|
||||
|
||||
protected:
|
||||
ViENetwork() {}
|
||||
virtual ~ViENetwork() {}
|
||||
|
@ -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/udp_transport/include/channel_transport.h"
|
||||
|
||||
#define WEBRTC_LOG_TAG "*WEBRTCN*"
|
||||
#define VALIDATE_BASE_POINTER \
|
||||
if (!voeData.base) \
|
||||
@ -107,6 +110,8 @@ typedef struct
|
||||
VoEHardware* hardware;
|
||||
VoERTP_RTCP* rtp;
|
||||
JavaVM* jvm;
|
||||
scoped_ptr<VoiceChannelTransport> transport;
|
||||
// TODO
|
||||
} VoiceEngineData;
|
||||
|
||||
class AndroidVideoRenderCallback;
|
||||
@ -122,6 +127,7 @@ typedef struct
|
||||
ViECapture* capture;
|
||||
ViEExternalCodec* externalCodec;
|
||||
VideoCallbackAndroid* callback;
|
||||
scoped_ptr<VideoChannelTransport> transport;
|
||||
|
||||
} VideoEngineData;
|
||||
|
||||
@ -589,7 +595,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 +616,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 +649,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 +1270,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 +1301,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 +1328,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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -54,10 +54,6 @@ TEST_F(ViEStandardIntegrationTest, RunsImageProcessTestWithoutErrors) {
|
||||
tests_->ViEImageProcessStandardTest();
|
||||
}
|
||||
|
||||
TEST_F(ViEStandardIntegrationTest, RunsNetworkTestWithoutErrors) {
|
||||
tests_->ViENetworkStandardTest();
|
||||
}
|
||||
|
||||
TEST_F(ViEStandardIntegrationTest, RunsRenderTestWithoutErrors) {
|
||||
tests_->ViERenderStandardTest();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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/udp_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::scoped_ptr<webrtc::VideoChannelTransport> video_channel_transport_1(
|
||||
new webrtc::VideoChannelTransport(vie_network, video_channel));
|
||||
|
||||
ASSERT_EQ(0, video_channel_transport_1->SetSendDestination(ip_address,
|
||||
send_port));
|
||||
|
||||
webrtc::scoped_ptr<webrtc::VideoChannelTransport> video_channel_transport_2(
|
||||
new webrtc::VideoChannelTransport(vie_network, video_channel2));
|
||||
|
||||
webrtc::scoped_ptr<webrtc::VideoChannelTransport> video_channel_transport_3(
|
||||
new webrtc::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));
|
||||
|
@ -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/udp_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,16 @@ 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));
|
||||
EXPECT_EQ(0, base->StartReceive(video_channel));
|
||||
EXPECT_EQ(0, network->SetSendDestination(
|
||||
video_channel, ip_address, rtp_port));
|
||||
|
||||
webrtc::scoped_ptr<webrtc::VideoChannelTransport> video_channel_transport(
|
||||
new webrtc::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));
|
||||
|
||||
// Make sure all codecs runs
|
||||
@ -300,10 +306,14 @@ 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::VideoChannelTransport> video_channel_transport(
|
||||
new webrtc::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));
|
||||
|
||||
// Codec specific tests
|
||||
@ -329,6 +339,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 +352,25 @@ 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::VideoChannelTransport> video_channel_transport_1(
|
||||
new webrtc::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::VideoChannelTransport> video_channel_transport_2(
|
||||
new webrtc::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 +502,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("========================================");
|
||||
|
@ -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/udp_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,8 @@ int ViEAutoTest::ViECustomCall() {
|
||||
int buffer_delay_ms = 0;
|
||||
bool is_image_scale_enabled = false;
|
||||
bool remb = true;
|
||||
webrtc::scoped_ptr<webrtc::VideoChannelTransport> video_channel_transport;
|
||||
webrtc::scoped_ptr<webrtc::VoiceChannelTransport> voice_channel_transport;
|
||||
|
||||
while (!start_call) {
|
||||
// Get the IP address to use from call.
|
||||
@ -340,13 +351,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::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 +487,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::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__);
|
||||
|
@ -18,6 +18,9 @@
|
||||
|
||||
#include "voe_codec.h"
|
||||
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/test/udp_transport/include/channel_transport.h"
|
||||
|
||||
class ViEAutotestFileObserver: public webrtc::ViEFileObserver
|
||||
{
|
||||
public:
|
||||
@ -103,14 +106,18 @@ 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::VideoChannelTransport>
|
||||
video_channel_transport(
|
||||
new webrtc::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);
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "vie_network.h"
|
||||
#include "vie_render.h"
|
||||
#include "vie_rtp_rtcp.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/test/udp_transport/include/channel_transport.h"
|
||||
|
||||
#define VCM_RED_PAYLOAD_TYPE 96
|
||||
#define VCM_ULPFEC_PAYLOAD_TYPE 97
|
||||
@ -472,6 +474,9 @@ int VideoEngineSampleCode(void* window1, void* window2)
|
||||
// Setting External transport
|
||||
TbExternalTransport extTransport(*(ptrViENetwork), videoChannel, NULL);
|
||||
|
||||
webrtc::scoped_ptr<webrtc::VideoChannelTransport> video_channel_transport(
|
||||
new webrtc::VideoChannelTransport(ptrViENetwork, videoChannel));
|
||||
|
||||
int testMode = 0;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Enter 1 for testing packet loss and delay with "
|
||||
@ -524,17 +529,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;
|
||||
}
|
||||
}
|
||||
|
@ -1,573 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
//
|
||||
// vie_autotest_network.cc
|
||||
//
|
||||
|
||||
#include "vie_autotest_defines.h"
|
||||
#include "vie_autotest.h"
|
||||
#include "engine_configurations.h"
|
||||
|
||||
#include "tb_capture_device.h"
|
||||
#include "tb_external_transport.h"
|
||||
#include "tb_interfaces.h"
|
||||
#include "tb_video_channel.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <qos.h>
|
||||
#endif
|
||||
|
||||
class ViEAutoTestNetworkObserver: public webrtc::ViENetworkObserver
|
||||
{
|
||||
public:
|
||||
ViEAutoTestNetworkObserver()
|
||||
{
|
||||
}
|
||||
virtual ~ViEAutoTestNetworkObserver()
|
||||
{
|
||||
}
|
||||
virtual void OnPeriodicDeadOrAlive(const int videoChannel, const bool alive)
|
||||
{
|
||||
}
|
||||
virtual void PacketTimeout(const int videoChannel,
|
||||
const webrtc::ViEPacketTimeout timeout)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
void ViEAutoTest::ViENetworkStandardTest()
|
||||
{
|
||||
TbInterfaces ViE("ViENetworkStandardTest"); // Create VIE
|
||||
TbCaptureDevice tbCapture(ViE);
|
||||
{
|
||||
// Create a video channel
|
||||
TbVideoChannel tbChannel(ViE, webrtc::kVideoCodecVP8);
|
||||
tbCapture.ConnectTo(tbChannel.videoChannel);
|
||||
|
||||
RenderCaptureDeviceAndOutputStream(&ViE, &tbChannel, &tbCapture);
|
||||
|
||||
// ***************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
// ***************************************************************
|
||||
|
||||
//
|
||||
// Transport
|
||||
//
|
||||
TbExternalTransport testTransport(*ViE.network, tbChannel.videoChannel,
|
||||
NULL);
|
||||
EXPECT_EQ(0, ViE.network->RegisterSendTransport(
|
||||
tbChannel.videoChannel, testTransport));
|
||||
EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.rtp_rtcp->SetKeyFrameRequestMethod(
|
||||
tbChannel.videoChannel, webrtc::kViEKeyFrameRequestPliRtcp));
|
||||
|
||||
ViETest::Log("Call started using external transport, video should "
|
||||
"see video in both windows\n");
|
||||
AutoTestSleep(kAutoTestSleepTimeMs);
|
||||
|
||||
EXPECT_EQ(0, ViE.base->StopReceive(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.base->StopSend(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.network->DeregisterSendTransport(
|
||||
tbChannel.videoChannel));
|
||||
|
||||
char myIpAddress[64];
|
||||
memset(myIpAddress, 0, 64);
|
||||
unsigned short rtpPort = 1234;
|
||||
memcpy(myIpAddress, "127.0.0.1", sizeof("127.0.0.1"));
|
||||
EXPECT_EQ(0, ViE.network->SetLocalReceiver(
|
||||
tbChannel.videoChannel, rtpPort, rtpPort + 1, myIpAddress));
|
||||
EXPECT_EQ(0, ViE.network->SetSendDestination(
|
||||
tbChannel.videoChannel, myIpAddress, rtpPort,
|
||||
rtpPort + 1, rtpPort));
|
||||
EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
|
||||
|
||||
ViETest::Log("Changed to WebRTC SocketTransport, you should still see "
|
||||
"video in both windows\n");
|
||||
AutoTestSleep(kAutoTestSleepTimeMs);
|
||||
|
||||
EXPECT_EQ(0, ViE.network->SetSourceFilter(
|
||||
tbChannel.videoChannel, rtpPort + 10, rtpPort + 11, myIpAddress));
|
||||
ViETest::Log("Added UDP port filter for incorrect ports, you should "
|
||||
"not see video in Window2");
|
||||
AutoTestSleep(2000);
|
||||
EXPECT_EQ(0, ViE.network->SetSourceFilter(
|
||||
tbChannel.videoChannel, rtpPort, rtpPort + 1, "123.1.1.0"));
|
||||
ViETest::Log("Added IP filter for incorrect IP address, you should not "
|
||||
"see video in Window2");
|
||||
AutoTestSleep(2000);
|
||||
EXPECT_EQ(0, ViE.network->SetSourceFilter(
|
||||
tbChannel.videoChannel, rtpPort, rtpPort + 1, myIpAddress));
|
||||
ViETest::Log("Added IP filter for this computer, you should see video "
|
||||
"in Window2 again\n");
|
||||
AutoTestSleep(kAutoTestSleepTimeMs);
|
||||
|
||||
tbCapture.Disconnect(tbChannel.videoChannel);
|
||||
}
|
||||
}
|
||||
|
||||
void ViEAutoTest::ViENetworkExtendedTest()
|
||||
{
|
||||
//***************************************************************
|
||||
// Begin create/initialize WebRTC Video Engine for testing
|
||||
//***************************************************************
|
||||
|
||||
TbInterfaces ViE("ViENetworkExtendedTest"); // Create VIE
|
||||
TbCaptureDevice tbCapture(ViE);
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
tbCapture.captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(tbCapture.captureId));
|
||||
|
||||
{
|
||||
//
|
||||
// ToS
|
||||
//
|
||||
// Create a video channel
|
||||
TbVideoChannel tbChannel(ViE, webrtc::kVideoCodecVP8);
|
||||
tbCapture.ConnectTo(tbChannel.videoChannel);
|
||||
const char* remoteIp = "192.168.200.1";
|
||||
int DSCP = 0;
|
||||
bool useSetSockOpt = false;
|
||||
|
||||
webrtc::VideoCodec videoCodec;
|
||||
EXPECT_EQ(0, ViE.codec->GetSendCodec(
|
||||
tbChannel.videoChannel, videoCodec));
|
||||
videoCodec.maxFramerate = 5;
|
||||
EXPECT_EQ(0, ViE.codec->SetSendCodec(
|
||||
tbChannel.videoChannel, videoCodec));
|
||||
|
||||
//***************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
//***************************************************************
|
||||
|
||||
char myIpAddress[64];
|
||||
memset(myIpAddress, 0, 64);
|
||||
unsigned short rtpPort = 9000;
|
||||
EXPECT_EQ(0, ViE.network->GetLocalIP(myIpAddress, false));
|
||||
EXPECT_EQ(0, ViE.network->SetLocalReceiver(
|
||||
tbChannel.videoChannel, rtpPort, rtpPort + 1, myIpAddress));
|
||||
EXPECT_EQ(0, ViE.network->SetSendDestination(
|
||||
tbChannel.videoChannel, remoteIp, rtpPort, rtpPort + 1, rtpPort));
|
||||
|
||||
// ToS
|
||||
int tos_result = ViE.network->SetSendToS(tbChannel.videoChannel, 2);
|
||||
EXPECT_EQ(0, tos_result);
|
||||
if (tos_result != 0)
|
||||
{
|
||||
ViETest::Log("ViESetSendToS error!.");
|
||||
ViETest::Log("You must be admin to run these tests.");
|
||||
ViETest::Log("On Win7 and late Vista, you need to right click the "
|
||||
"exe and choose");
|
||||
ViETest::Log("\"Run as administrator\"\n");
|
||||
getchar();
|
||||
}
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt)); // No ToS set
|
||||
|
||||
EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
|
||||
|
||||
ViETest::Log("Use Wireshark to capture the outgoing video stream and "
|
||||
"verify ToS settings\n");
|
||||
ViETest::Log(" DSCP set to 0x%x\n", DSCP);
|
||||
AutoTestSleep(1000);
|
||||
|
||||
EXPECT_EQ(0, ViE.network->SetSendToS(tbChannel.videoChannel, 63));
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt)); // No ToS set
|
||||
ViETest::Log(" DSCP set to 0x%x\n", DSCP);
|
||||
AutoTestSleep(1000);
|
||||
|
||||
EXPECT_EQ(0, ViE.network->SetSendToS(tbChannel.videoChannel, 0));
|
||||
EXPECT_EQ(0, ViE.network->SetSendToS(tbChannel.videoChannel, 2, true));
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt)); // No ToS set
|
||||
ViETest::Log(" DSCP set to 0x%x\n", DSCP);
|
||||
AutoTestSleep(1000);
|
||||
|
||||
EXPECT_EQ(0, ViE.network->SetSendToS(tbChannel.videoChannel, 63, true));
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt)); // No ToS set
|
||||
ViETest::Log(" DSCP set to 0x%x\n", DSCP);
|
||||
AutoTestSleep(1000);
|
||||
|
||||
tbCapture.Disconnect(tbChannel.videoChannel);
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
// Testing finished. Tear down Video Engine
|
||||
//***************************************************************
|
||||
}
|
||||
|
||||
void ViEAutoTest::ViENetworkAPITest()
|
||||
{
|
||||
//***************************************************************
|
||||
// Begin create/initialize WebRTC Video Engine for testing
|
||||
//***************************************************************
|
||||
|
||||
TbInterfaces ViE("ViENetworkAPITest"); // Create VIE
|
||||
{
|
||||
// Create a video channel
|
||||
TbVideoChannel tbChannel(ViE, webrtc::kVideoCodecI420);
|
||||
|
||||
//***************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
//***************************************************************
|
||||
|
||||
//
|
||||
// External transport
|
||||
//
|
||||
TbExternalTransport testTransport(*ViE.network, tbChannel.videoChannel,
|
||||
NULL);
|
||||
EXPECT_EQ(0, ViE.network->RegisterSendTransport(
|
||||
tbChannel.videoChannel, testTransport));
|
||||
EXPECT_NE(0, ViE.network->RegisterSendTransport(
|
||||
tbChannel.videoChannel, testTransport));
|
||||
|
||||
// Create a empty RTP packet.
|
||||
unsigned char packet[3000];
|
||||
memset(packet, 0, sizeof(packet));
|
||||
packet[0] = 0x80; // V=2, P=0, X=0, CC=0
|
||||
packet[1] = 0x7C; // M=0, PT = 124 (I420)
|
||||
|
||||
// Create a empty RTCP app packet.
|
||||
unsigned char rtcpacket[3000];
|
||||
memset(rtcpacket,0, sizeof(rtcpacket));
|
||||
rtcpacket[0] = 0x80; // V=2, P=0, X=0, CC=0
|
||||
rtcpacket[1] = 0xCC; // M=0, PT = 204 (RTCP app)
|
||||
rtcpacket[2] = 0x0;
|
||||
rtcpacket[3] = 0x03; // 3 Octets long.
|
||||
|
||||
EXPECT_NE(0, ViE.network->ReceivedRTPPacket(
|
||||
tbChannel.videoChannel, packet, 1500));
|
||||
EXPECT_NE(0, ViE.network->ReceivedRTCPPacket(
|
||||
tbChannel.videoChannel, rtcpacket, 1500));
|
||||
EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.network->ReceivedRTPPacket(
|
||||
tbChannel.videoChannel, packet, 1500));
|
||||
EXPECT_EQ(0, ViE.network->ReceivedRTCPPacket(
|
||||
tbChannel.videoChannel, rtcpacket, 1500));
|
||||
EXPECT_NE(0, ViE.network->ReceivedRTPPacket(
|
||||
tbChannel.videoChannel, packet, 11));
|
||||
EXPECT_NE(0, ViE.network->ReceivedRTPPacket(
|
||||
tbChannel.videoChannel, packet, 11));
|
||||
EXPECT_EQ(0, ViE.network->ReceivedRTPPacket(
|
||||
tbChannel.videoChannel, packet, 3000));
|
||||
EXPECT_EQ(0, ViE.network->ReceivedRTPPacket(
|
||||
tbChannel.videoChannel, packet, 3000));
|
||||
EXPECT_EQ(0, ViE.base->StopReceive(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
|
||||
EXPECT_NE(0, ViE.network->DeregisterSendTransport(
|
||||
tbChannel.videoChannel)); // Sending
|
||||
EXPECT_EQ(0, ViE.base->StopSend(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.network->DeregisterSendTransport(
|
||||
tbChannel.videoChannel));
|
||||
EXPECT_NE(0, ViE.network->DeregisterSendTransport(
|
||||
tbChannel.videoChannel)); // Already deregistered
|
||||
|
||||
//
|
||||
// Local receiver
|
||||
//
|
||||
EXPECT_EQ(0, ViE.network->SetLocalReceiver(
|
||||
tbChannel.videoChannel, 1234, 1235, "127.0.0.1"));
|
||||
EXPECT_EQ(0, ViE.network->SetLocalReceiver(
|
||||
tbChannel.videoChannel, 1234, 1235, "127.0.0.1"));
|
||||
EXPECT_EQ(0, ViE.network->SetLocalReceiver(
|
||||
tbChannel.videoChannel, 1236, 1237, "127.0.0.1"));
|
||||
|
||||
unsigned short rtpPort = 0;
|
||||
unsigned short rtcpPort = 0;
|
||||
char ipAddress[64];
|
||||
memset(ipAddress, 0, 64);
|
||||
EXPECT_EQ(0, ViE.network->GetLocalReceiver(
|
||||
tbChannel.videoChannel, rtpPort, rtcpPort, ipAddress));
|
||||
EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel));
|
||||
EXPECT_NE(0, ViE.network->SetLocalReceiver(
|
||||
tbChannel.videoChannel, 1234, 1235, "127.0.0.1"));
|
||||
EXPECT_EQ(0, ViE.network->GetLocalReceiver(
|
||||
tbChannel.videoChannel, rtpPort, rtcpPort, ipAddress));
|
||||
EXPECT_EQ(0, ViE.base->StopReceive(tbChannel.videoChannel));
|
||||
|
||||
//
|
||||
// Send destination
|
||||
//
|
||||
EXPECT_EQ(0, ViE.network->SetSendDestination(
|
||||
tbChannel.videoChannel, "127.0.0.1", 1234, 1235, 1234, 1235));
|
||||
EXPECT_EQ(0, ViE.network->SetSendDestination(
|
||||
tbChannel.videoChannel, "127.0.0.1", 1236, 1237, 1234, 1235));
|
||||
|
||||
unsigned short sourceRtpPort = 0;
|
||||
unsigned short sourceRtcpPort = 0;
|
||||
EXPECT_EQ(0, ViE.network->GetSendDestination(
|
||||
tbChannel.videoChannel, ipAddress, rtpPort, rtcpPort,
|
||||
sourceRtpPort, sourceRtcpPort));
|
||||
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
|
||||
|
||||
// Not allowed while sending
|
||||
EXPECT_NE(0, ViE.network->SetSendDestination(
|
||||
tbChannel.videoChannel, "127.0.0.1", 1234, 1235, 1234, 1235));
|
||||
EXPECT_EQ(kViENetworkAlreadySending, ViE.base->LastError());
|
||||
|
||||
EXPECT_EQ(0, ViE.base->StopSend(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.network->SetSendDestination(
|
||||
tbChannel.videoChannel, "127.0.0.1", 1234, 1235, 1234, 1235));
|
||||
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
|
||||
EXPECT_EQ(0, ViE.network->GetSendDestination(
|
||||
tbChannel.videoChannel, ipAddress, rtpPort, rtcpPort,
|
||||
sourceRtpPort, sourceRtcpPort));
|
||||
EXPECT_EQ(0, ViE.base->StopSend(tbChannel.videoChannel));
|
||||
|
||||
//
|
||||
// Address information
|
||||
//
|
||||
|
||||
// GetSourceInfo: Tested in functional test
|
||||
EXPECT_EQ(0, ViE.network->GetLocalIP(ipAddress, false));
|
||||
|
||||
// TODO(unknown): IPv6
|
||||
|
||||
//
|
||||
// Filter
|
||||
//
|
||||
EXPECT_NE(0, ViE.network->GetSourceFilter(
|
||||
tbChannel.videoChannel, rtpPort, rtcpPort, ipAddress));
|
||||
EXPECT_EQ(0, ViE.network->SetSourceFilter(
|
||||
tbChannel.videoChannel, 1234, 1235, "10.10.10.10"));
|
||||
EXPECT_EQ(0, ViE.network->SetSourceFilter(
|
||||
tbChannel.videoChannel, 1236, 1237, "127.0.0.1"));
|
||||
EXPECT_EQ(0, ViE.network->GetSourceFilter(
|
||||
tbChannel.videoChannel, rtpPort, rtcpPort, ipAddress));
|
||||
EXPECT_EQ(0, ViE.network->SetSourceFilter(
|
||||
tbChannel.videoChannel, 0, 0, NULL));
|
||||
EXPECT_NE(0, ViE.network->GetSourceFilter(
|
||||
tbChannel.videoChannel, rtpPort, rtcpPort, ipAddress));
|
||||
}
|
||||
{
|
||||
TbVideoChannel tbChannel(ViE); // Create a video channel
|
||||
EXPECT_EQ(0, ViE.network->SetLocalReceiver(
|
||||
tbChannel.videoChannel, 1234));
|
||||
|
||||
int DSCP = 0;
|
||||
bool useSetSockOpt = false;
|
||||
// SetSockOpt should work without a locally bind socket
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt)); // No ToS set
|
||||
EXPECT_EQ(0, DSCP);
|
||||
|
||||
// Invalid input
|
||||
EXPECT_NE(0, ViE.network->SetSendToS(tbChannel.videoChannel, -1, true));
|
||||
|
||||
// Invalid input
|
||||
EXPECT_NE(0, ViE.network->SetSendToS(tbChannel.videoChannel, 64, true));
|
||||
|
||||
// Valid
|
||||
EXPECT_EQ(0, ViE.network->SetSendToS(tbChannel.videoChannel, 20, true));
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt));
|
||||
|
||||
EXPECT_EQ(20, DSCP);
|
||||
EXPECT_TRUE(useSetSockOpt);
|
||||
|
||||
// Disable
|
||||
EXPECT_EQ(0, ViE.network->SetSendToS(tbChannel.videoChannel, 0, true));
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt));
|
||||
EXPECT_EQ(0, DSCP);
|
||||
|
||||
char myIpAddress[64];
|
||||
memset(myIpAddress, 0, 64);
|
||||
// Get local ip to be able to set ToS withtou setSockOpt
|
||||
EXPECT_EQ(0, ViE.network->GetLocalIP(myIpAddress, false));
|
||||
EXPECT_EQ(0, ViE.network->SetLocalReceiver(
|
||||
tbChannel.videoChannel, 1234, 1235, myIpAddress));
|
||||
|
||||
// Invalid input
|
||||
EXPECT_NE(0, ViE.network->SetSendToS(
|
||||
tbChannel.videoChannel, -1, false));
|
||||
EXPECT_NE(0, ViE.network->SetSendToS(
|
||||
tbChannel.videoChannel, 64, false)); // Invalid input
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt)); // No ToS set
|
||||
EXPECT_EQ(0, DSCP);
|
||||
int tos_result = ViE.network->SetSendToS(
|
||||
tbChannel.videoChannel, 20, false); // Valid
|
||||
EXPECT_EQ(0, tos_result);
|
||||
if (tos_result != 0)
|
||||
{
|
||||
ViETest::Log("ViESetSendToS error!.");
|
||||
ViETest::Log("You must be admin to run these tests.");
|
||||
ViETest::Log("On Win7 and late Vista, you need to right click the "
|
||||
"exe and choose");
|
||||
ViETest::Log("\"Run as administrator\"\n");
|
||||
getchar();
|
||||
}
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt));
|
||||
EXPECT_EQ(20, DSCP);
|
||||
#ifdef _WIN32
|
||||
EXPECT_FALSE(useSetSockOpt);
|
||||
#else // useSetSockOpt is true on Linux and Mac
|
||||
EXPECT_TRUE(useSetSockOpt);
|
||||
#endif
|
||||
EXPECT_EQ(0, ViE.network->SetSendToS(tbChannel.videoChannel, 0, false));
|
||||
EXPECT_EQ(0, ViE.network->GetSendToS(
|
||||
tbChannel.videoChannel, DSCP, useSetSockOpt));
|
||||
EXPECT_EQ(0, DSCP);
|
||||
}
|
||||
{
|
||||
// From qos.h. (*) -> supported by ViE
|
||||
//
|
||||
// #define SERVICETYPE_NOTRAFFIC 0x00000000
|
||||
// #define SERVICETYPE_BESTEFFORT 0x00000001 (*)
|
||||
// #define SERVICETYPE_CONTROLLEDLOAD 0x00000002 (*)
|
||||
// #define SERVICETYPE_GUARANTEED 0x00000003 (*)
|
||||
// #define SERVICETYPE_NETWORK_UNAVAILABLE 0x00000004
|
||||
// #define SERVICETYPE_GENERAL_INFORMATION 0x00000005
|
||||
// #define SERVICETYPE_NOCHANGE 0x00000006
|
||||
// #define SERVICETYPE_NONCONFORMING 0x00000009
|
||||
// #define SERVICETYPE_NETWORK_CONTROL 0x0000000A
|
||||
// #define SERVICETYPE_QUALITATIVE 0x0000000D (*)
|
||||
//
|
||||
// #define SERVICE_BESTEFFORT 0x80010000
|
||||
// #define SERVICE_CONTROLLEDLOAD 0x80020000
|
||||
// #define SERVICE_GUARANTEED 0x80040000
|
||||
// #define SERVICE_QUALITATIVE 0x80200000
|
||||
|
||||
TbVideoChannel tbChannel(ViE); // Create a video channel
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
// These tests are disabled since they currently fail on Windows.
|
||||
// Exact reason is unkown.
|
||||
// See https://code.google.com/p/webrtc/issues/detail?id=1266.
|
||||
// TODO(mflodman): remove these APIs?
|
||||
|
||||
//// No socket
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_BESTEFFORT));
|
||||
|
||||
//EXPECT_EQ(0, ViE.network->SetLocalReceiver(
|
||||
// tbChannel.videoChannel, 1234));
|
||||
|
||||
//// Sender not initialized
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_BESTEFFORT));
|
||||
//EXPECT_EQ(0, ViE.network->SetSendDestination(
|
||||
// tbChannel.videoChannel, "127.0.0.1", 12345));
|
||||
|
||||
//// Try to set all non-supported service types
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_NOTRAFFIC));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_NETWORK_UNAVAILABLE));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_GENERAL_INFORMATION));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_NOCHANGE));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_NONCONFORMING));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_NOTRAFFIC));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_NETWORK_CONTROL));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICE_BESTEFFORT));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICE_CONTROLLEDLOAD));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICE_GUARANTEED));
|
||||
//EXPECT_NE(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICE_QUALITATIVE));
|
||||
|
||||
//// Loop through valid service settings
|
||||
//bool enabled = false;
|
||||
//int serviceType = 0;
|
||||
//int overrideDSCP = 0;
|
||||
|
||||
//EXPECT_EQ(0, ViE.network->GetSendGQoS(
|
||||
// tbChannel.videoChannel, enabled, serviceType, overrideDSCP));
|
||||
//EXPECT_FALSE(enabled);
|
||||
//EXPECT_EQ(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_BESTEFFORT));
|
||||
//EXPECT_EQ(0, ViE.network->GetSendGQoS(
|
||||
// tbChannel.videoChannel, enabled, serviceType, overrideDSCP));
|
||||
//EXPECT_TRUE(enabled);
|
||||
//EXPECT_EQ(SERVICETYPE_BESTEFFORT, serviceType);
|
||||
//EXPECT_FALSE(overrideDSCP);
|
||||
|
||||
//EXPECT_EQ(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_CONTROLLEDLOAD));
|
||||
//EXPECT_EQ(0, ViE.network->GetSendGQoS(
|
||||
// tbChannel.videoChannel, enabled, serviceType, overrideDSCP));
|
||||
//EXPECT_TRUE(enabled);
|
||||
//EXPECT_EQ(SERVICETYPE_CONTROLLEDLOAD, serviceType);
|
||||
//EXPECT_FALSE(overrideDSCP);
|
||||
|
||||
//EXPECT_EQ(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_GUARANTEED));
|
||||
//EXPECT_EQ(0, ViE.network->GetSendGQoS(
|
||||
// tbChannel.videoChannel, enabled, serviceType, overrideDSCP));
|
||||
//EXPECT_TRUE(enabled);
|
||||
//EXPECT_EQ(SERVICETYPE_GUARANTEED, serviceType);
|
||||
//EXPECT_FALSE(overrideDSCP);
|
||||
|
||||
//EXPECT_EQ(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, true, SERVICETYPE_QUALITATIVE));
|
||||
//EXPECT_EQ(0, ViE.network->GetSendGQoS(
|
||||
// tbChannel.videoChannel, enabled, serviceType, overrideDSCP));
|
||||
//EXPECT_TRUE(enabled);
|
||||
//EXPECT_EQ(SERVICETYPE_QUALITATIVE, serviceType);
|
||||
//EXPECT_FALSE(overrideDSCP);
|
||||
|
||||
//EXPECT_EQ(0, ViE.network->SetSendGQoS(
|
||||
// tbChannel.videoChannel, false, SERVICETYPE_QUALITATIVE));
|
||||
//EXPECT_EQ(0, ViE.network->GetSendGQoS(
|
||||
// tbChannel.videoChannel, enabled, serviceType, overrideDSCP));
|
||||
//EXPECT_FALSE(enabled);
|
||||
#endif
|
||||
}
|
||||
{
|
||||
//
|
||||
// MTU and packet burst
|
||||
//
|
||||
// Create a video channel
|
||||
TbVideoChannel tbChannel(ViE);
|
||||
// Invalid input
|
||||
EXPECT_NE(0, ViE.network->SetMTU(tbChannel.videoChannel, 1600));
|
||||
// Valid input
|
||||
EXPECT_EQ(0, ViE.network->SetMTU(tbChannel.videoChannel, 800));
|
||||
|
||||
//
|
||||
// Observer and timeout
|
||||
//
|
||||
ViEAutoTestNetworkObserver vieTestObserver;
|
||||
EXPECT_EQ(0, ViE.network->RegisterObserver(
|
||||
tbChannel.videoChannel, vieTestObserver));
|
||||
EXPECT_NE(0, ViE.network->RegisterObserver(
|
||||
tbChannel.videoChannel, vieTestObserver));
|
||||
EXPECT_EQ(0, ViE.network->SetPeriodicDeadOrAliveStatus(
|
||||
tbChannel.videoChannel, true)); // No observer
|
||||
EXPECT_EQ(0, ViE.network->DeregisterObserver(tbChannel.videoChannel));
|
||||
|
||||
EXPECT_NE(0, ViE.network->DeregisterObserver(tbChannel.videoChannel));
|
||||
EXPECT_NE(0, ViE.network->SetPeriodicDeadOrAliveStatus(
|
||||
tbChannel.videoChannel, true)); // No observer
|
||||
|
||||
// Packet timout notification
|
||||
EXPECT_EQ(0, ViE.network->SetPacketTimeoutNotification(
|
||||
tbChannel.videoChannel, true, 10));
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
// Testing finished. Tear down Video Engine
|
||||
//***************************************************************
|
||||
}
|
@ -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/udp_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,23 @@ 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::VoiceChannelTransport> voice_channel_transport(
|
||||
new webrtc::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 +359,17 @@ int VideoEngineSampleRecordCode(void* window1, void* window2) {
|
||||
printf("ERROR in ViENetwork::GetInterface\n");
|
||||
return -1;
|
||||
}
|
||||
webrtc::scoped_ptr<webrtc::VideoChannelTransport> video_channel_transport(
|
||||
new webrtc::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;
|
||||
}
|
||||
|
||||
@ -532,7 +538,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 +569,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));
|
||||
|
@ -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/udp_transport.gyp:udp_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',
|
||||
|
@ -11,32 +11,39 @@
|
||||
#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 {
|
||||
class VideoChannelTransport;
|
||||
} // 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::VideoChannelTransport> channel_transport_;
|
||||
};
|
||||
|
||||
|
||||
#endif // WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_VIDEO_CHANNEL_H_
|
||||
|
@ -11,82 +11,73 @@
|
||||
#include "video_engine/test/libvietest/include/tb_video_channel.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "webrtc/test/udp_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::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));
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
# ModulesShared
|
||||
'<(webrtc_root)/modules/modules.gyp:media_file',
|
||||
'<(webrtc_root)/modules/modules.gyp:rtp_rtcp',
|
||||
'<(webrtc_root)/modules/modules.gyp:udp_transport',
|
||||
'<(webrtc_root)/modules/modules.gyp:webrtc_utility',
|
||||
|
||||
# ModulesVideo
|
||||
|
@ -325,14 +325,6 @@ int ViEBaseImpl::StartReceive(const int video_channel) {
|
||||
shared_data_.SetLastError(kViEBaseInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->Receiving()) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_.instance_id(), video_channel),
|
||||
"%s: Channel %d already receive.", __FUNCTION__,
|
||||
video_channel);
|
||||
shared_data_.SetLastError(kViEBaseAlreadyReceiving);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->StartReceive() != 0) {
|
||||
shared_data_.SetLastError(kViEBaseUnknownError);
|
||||
return -1;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/pacing/include/paced_sender.h"
|
||||
#include "modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||
#include "modules/udp_transport/interface/udp_transport.h"
|
||||
#include "modules/utility/interface/process_thread.h"
|
||||
#include "modules/video_coding/main/interface/video_coding.h"
|
||||
#include "modules/video_processing/main/interface/video_processing.h"
|
||||
@ -72,10 +71,6 @@ ViEChannel::ViEChannel(WebRtc_Word32 channel_id,
|
||||
rtp_rtcp_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
default_rtp_rtcp_(default_rtp_rtcp),
|
||||
rtp_rtcp_(NULL),
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
socket_transport_(*UdpTransport::Create(
|
||||
ViEModuleId(engine_id, channel_id), num_socket_threads_)),
|
||||
#endif
|
||||
vcm_(*VideoCodingModule::Create(ViEModuleId(engine_id, channel_id))),
|
||||
vie_receiver_(channel_id, &vcm_, remote_bitrate_estimator),
|
||||
vie_sender_(channel_id),
|
||||
@ -212,9 +207,6 @@ ViEChannel::~ViEChannel() {
|
||||
channel_id_, engine_id_);
|
||||
|
||||
// Make sure we don't get more callbacks from the RTP module.
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
socket_transport_.StopReceiving();
|
||||
#endif
|
||||
module_process_thread_.DeRegisterModule(rtp_rtcp_.get());
|
||||
module_process_thread_.DeRegisterModule(&vcm_);
|
||||
module_process_thread_.DeRegisterModule(&vie_sync_);
|
||||
@ -233,10 +225,6 @@ ViEChannel::~ViEChannel() {
|
||||
if (decode_thread_) {
|
||||
StopDecodeThread();
|
||||
}
|
||||
// Release modules.
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
UdpTransport::Destroy(&socket_transport_);
|
||||
#endif
|
||||
VideoCodingModule::Destroy(&vcm_);
|
||||
}
|
||||
|
||||
@ -1288,265 +1276,16 @@ WebRtc_Word32 ViEChannel::StopRTPDump(RTPDirections direction) {
|
||||
}
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::SetLocalReceiver(const WebRtc_UWord16 rtp_port,
|
||||
const WebRtc_UWord16 rtcp_port,
|
||||
const char* ip_address) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
callback_cs_->Enter();
|
||||
if (external_transport_) {
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.Receiving()) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: already receiving", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* multicast_ip_address = NULL;
|
||||
if (socket_transport_.InitializeReceiveSockets(&vie_receiver_, rtp_port,
|
||||
ip_address,
|
||||
multicast_ip_address,
|
||||
rtcp_port) != 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: could not initialize receive sockets. Socket error: %d",
|
||||
__FUNCTION__, socket_error);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::GetLocalReceiver(WebRtc_UWord16* rtp_port,
|
||||
WebRtc_UWord16* rtcp_port,
|
||||
char* ip_address) const {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
callback_cs_->Enter();
|
||||
if (external_transport_) {
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.ReceiveSocketsInitialized() == false) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: receive sockets not initialized", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
char multicast_ip_address[UdpTransport::kIpAddressVersion6Length];
|
||||
if (socket_transport_.ReceiveSocketInformation(ip_address, *rtp_port,
|
||||
*rtcp_port,
|
||||
multicast_ip_address) != 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: could not get receive socket information. Socket error: %d",
|
||||
__FUNCTION__, socket_error);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::SetSendDestination(
|
||||
const char* ip_address,
|
||||
const WebRtc_UWord16 rtp_port,
|
||||
const WebRtc_UWord16 rtcp_port,
|
||||
const WebRtc_UWord16 source_rtp_port,
|
||||
const WebRtc_UWord16 source_rtcp_port) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
callback_cs_->Enter();
|
||||
if (external_transport_) {
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
const bool is_ipv6 = socket_transport_.IpV6Enabled();
|
||||
if (UdpTransport::IsIpAddressValid(ip_address, is_ipv6) == false) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: Not a valid IP address: %s", __FUNCTION__, ip_address);
|
||||
return -1;
|
||||
}
|
||||
if (socket_transport_.InitializeSendSockets(ip_address, rtp_port,
|
||||
rtcp_port)!= 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: could not initialize send socket. Socket error: %d",
|
||||
__FUNCTION__, socket_error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (source_rtp_port != 0) {
|
||||
WebRtc_UWord16 receive_rtp_port = 0;
|
||||
WebRtc_UWord16 receive_rtcp_port = 0;
|
||||
if (socket_transport_.ReceiveSocketInformation(NULL, receive_rtp_port,
|
||||
receive_rtcp_port,
|
||||
NULL) != 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: could not get receive port information. Socket error: %d",
|
||||
__FUNCTION__, socket_error);
|
||||
return -1;
|
||||
}
|
||||
// Initialize an extra socket only if send port differs from receive
|
||||
// port.
|
||||
if (source_rtp_port != receive_rtp_port) {
|
||||
if (socket_transport_.InitializeSourcePorts(source_rtp_port,
|
||||
source_rtcp_port) != 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: could not set source ports. Socket error: %d",
|
||||
__FUNCTION__, socket_error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
vie_sender_.RegisterSendTransport(&socket_transport_);
|
||||
|
||||
// Workaround to avoid SSRC colision detection in loppback tests.
|
||||
if (!is_ipv6) {
|
||||
WebRtc_UWord32 local_host_address = 0;
|
||||
const WebRtc_UWord32 current_ip_address =
|
||||
UdpTransport::InetAddrIPV4(ip_address);
|
||||
|
||||
if ((UdpTransport::LocalHostAddress(local_host_address) == 0 &&
|
||||
local_host_address == current_ip_address) ||
|
||||
strncmp("127.0.0.1", ip_address, 9) == 0) {
|
||||
rtp_rtcp_->SetSSRC(0xFFFFFFFF);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"Running in loopback. Forcing fixed SSRC");
|
||||
}
|
||||
} else {
|
||||
char local_host_address[16];
|
||||
char current_ip_address[16];
|
||||
|
||||
WebRtc_Word32 conv_result =
|
||||
UdpTransport::LocalHostAddressIPV6(local_host_address);
|
||||
conv_result += socket_transport_.InetPresentationToNumeric(
|
||||
23, ip_address, current_ip_address);
|
||||
if (conv_result == 0) {
|
||||
bool local_host = true;
|
||||
for (WebRtc_Word32 i = 0; i < 16; i++) {
|
||||
if (local_host_address[i] != current_ip_address[i]) {
|
||||
local_host = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!local_host) {
|
||||
local_host = true;
|
||||
for (WebRtc_Word32 i = 0; i < 15; i++) {
|
||||
if (current_ip_address[i] != 0) {
|
||||
local_host = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (local_host == true && current_ip_address[15] != 1) {
|
||||
local_host = false;
|
||||
}
|
||||
}
|
||||
if (local_host) {
|
||||
rtp_rtcp_->SetSSRC(0xFFFFFFFF);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_),
|
||||
"Running in loopback. Forcing fixed SSRC");
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::GetSendDestination(
|
||||
char* ip_address,
|
||||
WebRtc_UWord16* rtp_port,
|
||||
WebRtc_UWord16* rtcp_port,
|
||||
WebRtc_UWord16* source_rtp_port,
|
||||
WebRtc_UWord16* source_rtcp_port) const {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
callback_cs_->Enter();
|
||||
if (external_transport_) {
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.SendSocketsInitialized() == false) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: send sockets not initialized", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
if (socket_transport_.SendSocketInformation(ip_address, *rtp_port,
|
||||
*rtcp_port) != 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: could not get send socket information. Socket error: %d",
|
||||
__FUNCTION__, socket_error);
|
||||
return -1;
|
||||
}
|
||||
*source_rtp_port = 0;
|
||||
*source_rtcp_port = 0;
|
||||
if (socket_transport_.SourcePortsInitialized()) {
|
||||
socket_transport_.SourcePorts(*source_rtp_port, *source_rtcp_port);
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::StartSend() {
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s", __FUNCTION__);
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!external_transport_) {
|
||||
if (socket_transport_.SendSocketsInitialized() == false) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: send sockets not initialized", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: send sockets not initialized", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
rtp_rtcp_->SetSendingMediaStatus(true);
|
||||
|
||||
if (rtp_rtcp_->Sending()) {
|
||||
@ -1615,35 +1354,10 @@ WebRtc_Word32 ViEChannel::StartReceive() {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!external_transport_) {
|
||||
if (socket_transport_.Receiving()) {
|
||||
// Warning, don't return error.
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: already receiving", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
if (socket_transport_.ReceiveSocketsInitialized() == false) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: receive sockets not initialized", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
if (socket_transport_.StartReceiving(kViENumReceiveSocketBuffers) != 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: could not get receive socket information. Socket error:%d",
|
||||
__FUNCTION__, socket_error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (StartDecodeThread() != 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: could not start decoder thread", __FUNCTION__);
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
socket_transport_.StopReceiving();
|
||||
#endif
|
||||
vie_receiver_.StopReceive();
|
||||
return -1;
|
||||
}
|
||||
@ -1659,100 +1373,12 @@ WebRtc_Word32 ViEChannel::StopReceive() {
|
||||
vie_receiver_.StopReceive();
|
||||
StopDecodeThread();
|
||||
vcm_.ResetDecoder();
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.Receiving() == false) {
|
||||
// Warning, don't return error
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_), "%s: not receiving",
|
||||
__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
if (socket_transport_.StopReceiving() != 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: Socket error: %d", __FUNCTION__, socket_error);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ViEChannel::Receiving() {
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
return socket_transport_.Receiving();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::GetSourceInfo(WebRtc_UWord16* rtp_port,
|
||||
WebRtc_UWord16* rtcp_port,
|
||||
char* ip_address,
|
||||
WebRtc_UWord32 ip_address_length) {
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.IpV6Enabled() &&
|
||||
ip_address_length < UdpTransport::kIpAddressVersion6Length) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: IP address length is too small for IPv6", __FUNCTION__);
|
||||
return -1;
|
||||
} else if (ip_address_length < UdpTransport::kIpAddressVersion4Length) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: IP address length is too small for IPv4", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (socket_transport_.RemoteSocketInformation(ip_address, *rtp_port,
|
||||
*rtcp_port) != 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: Error getting source ports. Socket error: %d",
|
||||
__FUNCTION__, socket_error);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::RegisterSendTransport(Transport* transport) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.SendSocketsInitialized() ||
|
||||
socket_transport_.ReceiveSocketsInitialized()) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: socket transport already initialized", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if (rtp_rtcp_->Sending()) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: Sending", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
@ -1790,258 +1416,14 @@ WebRtc_Word32 ViEChannel::DeregisterSendTransport() {
|
||||
|
||||
WebRtc_Word32 ViEChannel::ReceivedRTPPacket(
|
||||
const void* rtp_packet, const WebRtc_Word32 rtp_packet_length) {
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (!external_transport_) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return vie_receiver_.ReceivedRTPPacket(rtp_packet, rtp_packet_length);
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::ReceivedRTCPPacket(
|
||||
const void* rtcp_packet, const WebRtc_Word32 rtcp_packet_length) {
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (!external_transport_) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
const void* rtcp_packet, const WebRtc_Word32 rtcp_packet_length) {
|
||||
return vie_receiver_.ReceivedRTCPPacket(rtcp_packet, rtcp_packet_length);
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::EnableIPv6() {
|
||||
callback_cs_->Enter();
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s", __FUNCTION__);
|
||||
|
||||
if (external_transport_) {
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.IpV6Enabled()) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: IPv6 already enabled", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (socket_transport_.EnableIpV6() != 0) {
|
||||
WebRtc_Word32 socket_error = socket_transport_.LastError();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: could not enable IPv6. Socket error: %d", __FUNCTION__,
|
||||
socket_error);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ViEChannel::IsIPv6Enabled() {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
return socket_transport_.IpV6Enabled();
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::SetSourceFilter(const WebRtc_UWord16 rtp_port,
|
||||
const WebRtc_UWord16 rtcp_port,
|
||||
const char* ip_address) {
|
||||
callback_cs_->Enter();
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
if (external_transport_) {
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.SetFilterIP(ip_address) != 0) {
|
||||
// Logging done in module.
|
||||
return -1;
|
||||
}
|
||||
if (socket_transport_.SetFilterPorts(rtp_port, rtcp_port) != 0) {
|
||||
// Logging done.
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::GetSourceFilter(WebRtc_UWord16* rtp_port,
|
||||
WebRtc_UWord16* rtcp_port,
|
||||
char* ip_address) const {
|
||||
callback_cs_->Enter();
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
if (external_transport_) {
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.FilterIP(ip_address) != 0) {
|
||||
// Logging done in module.
|
||||
return -1;
|
||||
}
|
||||
if (socket_transport_.FilterPorts(*rtp_port, *rtcp_port) != 0) {
|
||||
// Logging done in module.
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::SetToS(const WebRtc_Word32 DSCP,
|
||||
const bool use_set_sockOpt) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.SetToS(DSCP, use_set_sockOpt) != 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: Socket error: %d", __FUNCTION__,
|
||||
socket_transport_.LastError());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::GetToS(WebRtc_Word32* DSCP,
|
||||
bool* use_set_sockOpt) const {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.ToS(*DSCP, *use_set_sockOpt) != 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: Socket error: %d", __FUNCTION__,
|
||||
socket_transport_.LastError());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::SetSendGQoS(const bool enable,
|
||||
const WebRtc_Word32 service_type,
|
||||
const WebRtc_UWord32 max_bitrate,
|
||||
const WebRtc_Word32 overrideDSCP) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.SetQoS(enable, service_type, max_bitrate, overrideDSCP,
|
||||
false) != 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: Socket error: %d", __FUNCTION__,
|
||||
socket_transport_.LastError());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::GetSendGQoS(bool* enabled,
|
||||
WebRtc_Word32* service_type,
|
||||
WebRtc_Word32* overrideDSCP) const {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.QoS(*enabled, *service_type, *overrideDSCP) != 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: Socket error: %d", __FUNCTION__,
|
||||
socket_transport_.LastError());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::SetMTU(WebRtc_UWord16 mtu) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
@ -2152,35 +1534,6 @@ WebRtc_Word32 ViEChannel::SetPeriodicDeadOrAliveStatus(
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::SendUDPPacket(const WebRtc_Word8* data,
|
||||
const WebRtc_UWord32 length,
|
||||
WebRtc_Word32& transmitted_bytes,
|
||||
bool use_rtcp_socket) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
transmitted_bytes = socket_transport_.SendRaw(data, length, use_rtcp_socket);
|
||||
if (transmitted_bytes == -1) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::EnableColorEnhancement(bool enable) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s(enable: %d)", __FUNCTION__, enable);
|
||||
@ -2394,7 +1747,7 @@ WebRtc_Word32 ViEChannel::DeRegisterExternalEncryption() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
external_transport_ = NULL;
|
||||
external_encryption_ = NULL;
|
||||
vie_receiver_.DeregisterExternalDecryption();
|
||||
vie_sender_.DeregisterExternalEncryption();
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
@ -2515,11 +1868,7 @@ void ViEChannel::OnPacketTimeout(const WebRtc_Word32 id) {
|
||||
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (networkObserver_) {
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.Receiving() || external_transport_) {
|
||||
#else
|
||||
if (external_transport_) {
|
||||
#endif
|
||||
networkObserver_->PacketTimeout(channel_id_, NoPacket);
|
||||
rtp_packet_timeout_ = true;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||
#include "modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||
#include "modules/udp_transport/interface/udp_transport.h"
|
||||
#include "modules/video_coding/main/interface/video_coding_defines.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "system_wrappers/interface/tick_util.h"
|
||||
@ -219,27 +218,6 @@ class ViEChannel
|
||||
const WebRtc_UWord32 CSRC,
|
||||
const bool added);
|
||||
|
||||
WebRtc_Word32 SetLocalReceiver(const WebRtc_UWord16 rtp_port,
|
||||
const WebRtc_UWord16 rtcp_port,
|
||||
const char* ip_address);
|
||||
WebRtc_Word32 GetLocalReceiver(WebRtc_UWord16* rtp_port,
|
||||
WebRtc_UWord16* rtcp_port,
|
||||
char* ip_address) const;
|
||||
WebRtc_Word32 SetSendDestination(const char* ip_address,
|
||||
const WebRtc_UWord16 rtp_port,
|
||||
const WebRtc_UWord16 rtcp_port,
|
||||
const WebRtc_UWord16 source_rtp_port,
|
||||
const WebRtc_UWord16 source_rtcp_port);
|
||||
WebRtc_Word32 GetSendDestination(char* ip_address,
|
||||
WebRtc_UWord16* rtp_port,
|
||||
WebRtc_UWord16* rtcp_port,
|
||||
WebRtc_UWord16* source_rtp_port,
|
||||
WebRtc_UWord16* source_rtcp_port) const;
|
||||
WebRtc_Word32 GetSourceInfo(WebRtc_UWord16* rtp_port,
|
||||
WebRtc_UWord16* rtcp_port,
|
||||
char* ip_address,
|
||||
WebRtc_UWord32 ip_address_length);
|
||||
|
||||
WebRtc_Word32 SetRemoteSSRCType(const StreamType usage,
|
||||
const uint32_t SSRC) const;
|
||||
|
||||
@ -248,7 +226,6 @@ class ViEChannel
|
||||
bool Sending();
|
||||
WebRtc_Word32 StartReceive();
|
||||
WebRtc_Word32 StopReceive();
|
||||
bool Receiving();
|
||||
|
||||
WebRtc_Word32 RegisterSendTransport(Transport* transport);
|
||||
WebRtc_Word32 DeregisterSendTransport();
|
||||
@ -261,25 +238,6 @@ class ViEChannel
|
||||
WebRtc_Word32 ReceivedRTCPPacket(const void* rtcp_packet,
|
||||
const WebRtc_Word32 rtcp_packet_length);
|
||||
|
||||
WebRtc_Word32 EnableIPv6();
|
||||
bool IsIPv6Enabled();
|
||||
WebRtc_Word32 SetSourceFilter(const WebRtc_UWord16 rtp_port,
|
||||
const WebRtc_UWord16 rtcp_port,
|
||||
const char* ip_address);
|
||||
WebRtc_Word32 GetSourceFilter(WebRtc_UWord16* rtp_port,
|
||||
WebRtc_UWord16* rtcp_port,
|
||||
char* ip_address) const;
|
||||
|
||||
WebRtc_Word32 SetToS(const WebRtc_Word32 DSCP, const bool use_set_sockOpt);
|
||||
WebRtc_Word32 GetToS(WebRtc_Word32* DSCP, bool* use_set_sockOpt) const;
|
||||
WebRtc_Word32 SetSendGQoS(const bool enable,
|
||||
const WebRtc_Word32 service_type,
|
||||
const WebRtc_UWord32 max_bitrate,
|
||||
const WebRtc_Word32 overrideDSCP);
|
||||
WebRtc_Word32 GetSendGQoS(bool* enabled,
|
||||
WebRtc_Word32* service_type,
|
||||
WebRtc_Word32* overrideDSCP) const;
|
||||
|
||||
// Sets the maximum transfer unit size for the network link, i.e. including
|
||||
// IP, UDP and RTP headers.
|
||||
WebRtc_Word32 SetMTU(WebRtc_UWord16 mtu);
|
||||
@ -298,11 +256,6 @@ class ViEChannel
|
||||
WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
|
||||
const bool enable, const WebRtc_UWord32 sample_time_seconds);
|
||||
|
||||
WebRtc_Word32 SendUDPPacket(const WebRtc_Word8* data,
|
||||
const WebRtc_UWord32 length,
|
||||
WebRtc_Word32& transmitted_bytes,
|
||||
bool use_rtcp_socket);
|
||||
|
||||
WebRtc_Word32 EnableColorEnhancement(bool enable);
|
||||
|
||||
// Gets the modules used by the channel.
|
||||
@ -384,9 +337,6 @@ class ViEChannel
|
||||
scoped_ptr<RtpRtcp> rtp_rtcp_;
|
||||
std::list<RtpRtcp*> simulcast_rtp_rtcp_;
|
||||
std::list<RtpRtcp*> removed_rtp_rtcp_;
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
UdpTransport& socket_transport_;
|
||||
#endif
|
||||
VideoCodingModule& vcm_;
|
||||
ViEReceiver vie_receiver_;
|
||||
ViESender vie_sender_;
|
||||
|
@ -127,14 +127,12 @@ bool VideoEngine::Delete(VideoEngine*& video_engine) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API
|
||||
ViENetworkImpl* vie_network = vie_impl;
|
||||
if (vie_network->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
|
||||
"ViENetwork ref count: %d", vie_network->GetCount());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
|
||||
ViERenderImpl* vie_render = vie_impl;
|
||||
if (vie_render->GetCount() > 0) {
|
||||
|
@ -31,9 +31,7 @@
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
|
||||
#include "video_engine/vie_image_process_impl.h"
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API
|
||||
#include "video_engine/vie_network_impl.h"
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
|
||||
#include "video_engine/vie_render_impl.h"
|
||||
#endif
|
||||
@ -63,9 +61,7 @@ class VideoEngineImpl
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
|
||||
, public ViEImageProcessImpl
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API
|
||||
, public ViENetworkImpl
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
|
||||
, public ViERenderImpl
|
||||
#endif
|
||||
@ -94,9 +90,7 @@ class VideoEngineImpl
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
|
||||
, ViEImageProcessImpl(ViEBaseImpl::shared_data())
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API
|
||||
, ViENetworkImpl(ViEBaseImpl::shared_data())
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
|
||||
, ViERenderImpl(ViEBaseImpl::shared_data())
|
||||
#endif
|
||||
|
@ -10,11 +10,6 @@
|
||||
|
||||
#include "video_engine/vie_network_impl.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#if (defined(WIN32_) || defined(WIN64_))
|
||||
#include <qos.h>
|
||||
#endif
|
||||
|
||||
#include "engine_configurations.h" // NOLINT
|
||||
#include "system_wrappers/interface/trace.h"
|
||||
#include "video_engine/include/vie_errors.h"
|
||||
@ -28,7 +23,6 @@
|
||||
namespace webrtc {
|
||||
|
||||
ViENetwork* ViENetwork::GetInterface(VideoEngine* video_engine) {
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API
|
||||
if (!video_engine) {
|
||||
return NULL;
|
||||
}
|
||||
@ -37,9 +31,6 @@ ViENetwork* ViENetwork::GetInterface(VideoEngine* video_engine) {
|
||||
// Increase ref count.
|
||||
(*vie_networkImpl)++;
|
||||
return vie_networkImpl;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int ViENetworkImpl::Release() {
|
||||
@ -71,140 +62,6 @@ ViENetworkImpl::~ViENetworkImpl() {
|
||||
"ViENetworkImpl::~ViENetworkImpl() Dtor");
|
||||
}
|
||||
|
||||
int ViENetworkImpl::SetLocalReceiver(const int video_channel,
|
||||
const uint16_t rtp_port,
|
||||
const uint16_t rtcp_port,
|
||||
const char* ip_address) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d, rtp_port: %u, rtcp_port: %u, ip_address: %s)",
|
||||
__FUNCTION__, video_channel, rtp_port, rtcp_port, ip_address);
|
||||
if (!shared_data_->Initialized()) {
|
||||
shared_data_->SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
shared_data_->instance_id());
|
||||
return -1;
|
||||
}
|
||||
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
// The channel doesn't exists.
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vie_channel->Receiving()) {
|
||||
shared_data_->SetLastError(kViENetworkAlreadyReceiving);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->SetLocalReceiver(rtp_port, rtcp_port, ip_address) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::GetLocalReceiver(const int video_channel,
|
||||
uint16_t& rtp_port,
|
||||
uint16_t& rtcp_port,
|
||||
char* ip_address) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->GetLocalReceiver(&rtp_port, &rtcp_port, ip_address) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkLocalReceiverNotSet);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::SetSendDestination(const int video_channel,
|
||||
const char* ip_address,
|
||||
const uint16_t rtp_port,
|
||||
const uint16_t rtcp_port,
|
||||
const uint16_t source_rtp_port,
|
||||
const uint16_t source_rtcp_port) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d, ip_address: %s, rtp_port: %u, rtcp_port: %u, "
|
||||
"sourceRtpPort: %u, source_rtcp_port: %u)",
|
||||
__FUNCTION__, video_channel, ip_address, rtp_port, rtcp_port,
|
||||
source_rtp_port, source_rtcp_port);
|
||||
if (!shared_data_->Initialized()) {
|
||||
shared_data_->SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
shared_data_->instance_id());
|
||||
return -1;
|
||||
}
|
||||
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s Channel doesn't exist", __FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->Sending()) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s Channel already sending.", __FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkAlreadySending);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->SetSendDestination(ip_address, rtp_port, rtcp_port,
|
||||
source_rtp_port,
|
||||
source_rtcp_port) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::GetSendDestination(const int video_channel,
|
||||
char* ip_address,
|
||||
uint16_t& rtp_port,
|
||||
uint16_t& rtcp_port,
|
||||
uint16_t& source_rtp_port,
|
||||
uint16_t& source_rtcp_port) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->GetSendDestination(ip_address, &rtp_port, &rtcp_port,
|
||||
&source_rtp_port,
|
||||
&source_rtcp_port) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkDestinationNotSet);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::RegisterSendTransport(const int video_channel,
|
||||
Transport& transport) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
@ -318,340 +175,6 @@ int ViENetworkImpl::ReceivedRTCPPacket(const int video_channel,
|
||||
return vie_channel->ReceivedRTCPPacket(data, length);
|
||||
}
|
||||
|
||||
int ViENetworkImpl::GetSourceInfo(const int video_channel,
|
||||
uint16_t& rtp_port,
|
||||
uint16_t& rtcp_port, char* ip_address,
|
||||
unsigned int ip_address_length) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->GetSourceInfo(&rtp_port, &rtcp_port, ip_address,
|
||||
ip_address_length) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::GetLocalIP(char ip_address[64], bool ipv6) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s( ip_address, ipV6: %d)", __FUNCTION__, ipv6);
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!shared_data_->Initialized()) {
|
||||
shared_data_->SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
shared_data_->instance_id());
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!ip_address) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s: No argument", __FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkInvalidArgument);
|
||||
return -1;
|
||||
}
|
||||
|
||||
WebRtc_UWord8 num_socket_threads = 1;
|
||||
UdpTransport* socket_transport = UdpTransport::Create(
|
||||
ViEModuleId(shared_data_->instance_id(), -1), num_socket_threads);
|
||||
|
||||
if (!socket_transport) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s: Could not create socket module", __FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
|
||||
char local_ip_address[64];
|
||||
if (ipv6) {
|
||||
char local_ip[16];
|
||||
if (socket_transport->LocalHostAddressIPV6(local_ip) != 0) {
|
||||
UdpTransport::Destroy(socket_transport);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s: Could not get local IP", __FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
// Convert 128-bit address to character string (a:b:c:d:e:f:g:h).
|
||||
// TODO(mflodman) Change sprintf.
|
||||
sprintf(local_ip_address, // NOLINT
|
||||
"%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:"
|
||||
"%.2x%.2x",
|
||||
local_ip[0], local_ip[1], local_ip[2], local_ip[3], local_ip[4],
|
||||
local_ip[5], local_ip[6], local_ip[7], local_ip[8], local_ip[9],
|
||||
local_ip[10], local_ip[11], local_ip[12], local_ip[13],
|
||||
local_ip[14], local_ip[15]);
|
||||
} else {
|
||||
WebRtc_UWord32 local_ip = 0;
|
||||
if (socket_transport->LocalHostAddress(local_ip) != 0) {
|
||||
UdpTransport::Destroy(socket_transport);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s: Could not get local IP", __FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
// Convert 32-bit address to character string (x.y.z.w).
|
||||
// TODO(mflodman) Change sprintf.
|
||||
sprintf(local_ip_address, "%d.%d.%d.%d", // NOLINT
|
||||
static_cast<int>((local_ip >> 24) & 0x0ff),
|
||||
static_cast<int>((local_ip >> 16) & 0x0ff),
|
||||
static_cast<int>((local_ip >> 8) & 0x0ff),
|
||||
static_cast<int>(local_ip & 0x0ff));
|
||||
}
|
||||
strncpy(ip_address, local_ip_address, sizeof(local_ip_address));
|
||||
UdpTransport::Destroy(socket_transport);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s: local ip = %s", __FUNCTION__, local_ip_address);
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s: not available for external transport", __FUNCTION__);
|
||||
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int ViENetworkImpl::EnableIPv6(int video_channel) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->EnableIPv6() != 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ViENetworkImpl::IsIPv6Enabled(int video_channel) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return false;
|
||||
}
|
||||
return vie_channel->IsIPv6Enabled();
|
||||
}
|
||||
|
||||
int ViENetworkImpl::SetSourceFilter(const int video_channel,
|
||||
const uint16_t rtp_port,
|
||||
const uint16_t rtcp_port,
|
||||
const char* ip_address) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d, rtp_port: %u, rtcp_port: %u, ip_address: %s)",
|
||||
__FUNCTION__, video_channel, rtp_port, rtcp_port, ip_address);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->SetSourceFilter(rtp_port, rtcp_port, ip_address) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::GetSourceFilter(const int video_channel,
|
||||
uint16_t& rtp_port,
|
||||
uint16_t& rtcp_port,
|
||||
char* ip_address) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->GetSourceFilter(&rtp_port, &rtcp_port, ip_address) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::SetSendToS(const int video_channel, const int DSCP,
|
||||
const bool use_set_sockOpt = false) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d, DSCP: %d, use_set_sockOpt: %d)", __FUNCTION__,
|
||||
video_channel, DSCP, use_set_sockOpt);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
" force use_set_sockopt=true since there is no alternative"
|
||||
" implementation");
|
||||
if (vie_channel->SetToS(DSCP, true) != 0) {
|
||||
#else
|
||||
if (vie_channel->SetToS(DSCP, use_set_sockOpt) != 0) {
|
||||
#endif
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::GetSendToS(const int video_channel,
|
||||
int& DSCP, // NOLINT
|
||||
bool& use_set_sockOpt) { // NOLINT
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->GetToS(&DSCP, &use_set_sockOpt) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::SetSendGQoS(const int video_channel, const bool enable,
|
||||
const int service_type,
|
||||
const int overrideDSCP) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d, enable: %d, service_type: %d, "
|
||||
"overrideDSCP: %d)", __FUNCTION__, video_channel, enable,
|
||||
service_type, overrideDSCP);
|
||||
if (!shared_data_->Initialized()) {
|
||||
shared_data_->SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
shared_data_->instance_id());
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if (defined(WIN32_) || defined(WIN64_))
|
||||
// Sanity check. We might crash if testing and relying on an OS socket error.
|
||||
if (enable &&
|
||||
(service_type != SERVICETYPE_BESTEFFORT) &&
|
||||
(service_type != SERVICETYPE_CONTROLLEDLOAD) &&
|
||||
(service_type != SERVICETYPE_GUARANTEED) &&
|
||||
(service_type != SERVICETYPE_QUALITATIVE)) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s: service type %d not supported", __FUNCTION__,
|
||||
video_channel, service_type);
|
||||
shared_data_->SetLastError(kViENetworkServiceTypeNotSupported);
|
||||
return -1;
|
||||
}
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
|
||||
if (!vie_encoder) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
VideoCodec video_codec;
|
||||
if (vie_encoder->GetEncoder(video_codec) != 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s: Could not get max bitrate for the channel",
|
||||
__FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkSendCodecNotSet);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->SetSendGQoS(enable, service_type, video_codec.maxBitrate,
|
||||
overrideDSCP) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s: Not supported", __FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkNotSupported);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int ViENetworkImpl::GetSendGQoS(const int video_channel,
|
||||
bool& enabled, // NOLINT
|
||||
int& service_type, // NOLINT
|
||||
int& overrideDSCP) { // NOLINT
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->GetSendGQoS(&enabled, &service_type, &overrideDSCP) != 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::SetMTU(int video_channel, unsigned int mtu) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
@ -766,38 +289,4 @@ int ViENetworkImpl::SetPeriodicDeadOrAliveStatus(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViENetworkImpl::SendUDPPacket(const int video_channel, const void* data,
|
||||
const unsigned int length,
|
||||
int& transmitted_bytes,
|
||||
bool use_rtcp_socket = false) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d, data: -, length: %d, transmitter_bytes: -, "
|
||||
"useRtcpSocket: %d)", __FUNCTION__, video_channel, length,
|
||||
use_rtcp_socket);
|
||||
if (!shared_data_->Initialized()) {
|
||||
shared_data_->SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
shared_data_->instance_id());
|
||||
return -1;
|
||||
}
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->SendUDPPacket((const WebRtc_Word8*) data, length,
|
||||
(WebRtc_Word32&) transmitted_bytes,
|
||||
use_rtcp_socket) < 0) {
|
||||
shared_data_->SetLastError(kViENetworkUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -25,26 +25,6 @@ class ViENetworkImpl
|
||||
public:
|
||||
// Implements ViENetwork.
|
||||
virtual int Release();
|
||||
virtual int SetLocalReceiver(const int video_channel,
|
||||
const uint16_t rtp_port,
|
||||
const uint16_t rtcp_port,
|
||||
const char* ip_address);
|
||||
virtual int GetLocalReceiver(const int video_channel,
|
||||
uint16_t& rtp_port,
|
||||
uint16_t& rtcp_port,
|
||||
char* ip_address);
|
||||
virtual int SetSendDestination(const int video_channel,
|
||||
const char* ip_address,
|
||||
const uint16_t rtp_port,
|
||||
const uint16_t rtcp_port,
|
||||
const uint16_t source_rtp_port,
|
||||
const uint16_t source_rtcp_port);
|
||||
virtual int GetSendDestination(const int video_channel,
|
||||
char* ip_address,
|
||||
uint16_t& rtp_port,
|
||||
uint16_t& rtcp_port,
|
||||
uint16_t& source_rtp_port,
|
||||
uint16_t& source_rtcp_port);
|
||||
virtual int RegisterSendTransport(const int video_channel,
|
||||
Transport& transport);
|
||||
virtual int DeregisterSendTransport(const int video_channel);
|
||||
@ -54,36 +34,6 @@ class ViENetworkImpl
|
||||
virtual int ReceivedRTCPPacket(const int video_channel,
|
||||
const void* data,
|
||||
const int length);
|
||||
virtual int GetSourceInfo(const int video_channel,
|
||||
uint16_t& rtp_port,
|
||||
uint16_t& rtcp_port,
|
||||
char* ip_address,
|
||||
unsigned int ip_address_length);
|
||||
virtual int GetLocalIP(char ip_address[64], bool ipv6);
|
||||
virtual int EnableIPv6(int video_channel);
|
||||
virtual bool IsIPv6Enabled(int video_channel);
|
||||
virtual int SetSourceFilter(const int video_channel,
|
||||
const uint16_t rtp_port,
|
||||
const uint16_t rtcp_port,
|
||||
const char* ip_address);
|
||||
virtual int GetSourceFilter(const int video_channel,
|
||||
uint16_t& rtp_port,
|
||||
uint16_t& rtcp_port,
|
||||
char* ip_address);
|
||||
virtual int SetSendToS(const int video_channel,
|
||||
const int DSCP,
|
||||
const bool use_set_sockOpt);
|
||||
virtual int GetSendToS(const int video_channel,
|
||||
int& DSCP,
|
||||
bool& use_set_sockOpt);
|
||||
virtual int SetSendGQoS(const int video_channel,
|
||||
const bool enable,
|
||||
const int service_type,
|
||||
const int overrideDSCP);
|
||||
virtual int GetSendGQoS(const int video_channel,
|
||||
bool& enabled,
|
||||
int& service_type,
|
||||
int& overrideDSCP);
|
||||
virtual int SetMTU(int video_channel, unsigned int mtu);
|
||||
virtual int SetPacketTimeoutNotification(const int video_channel,
|
||||
bool enable,
|
||||
@ -95,11 +45,6 @@ class ViENetworkImpl
|
||||
const int video_channel,
|
||||
const bool enable,
|
||||
const unsigned int sample_time_seconds);
|
||||
virtual int SendUDPPacket(const int video_channel,
|
||||
const void* data,
|
||||
const unsigned int length,
|
||||
int& transmitted_bytes,
|
||||
bool use_rtcp_socket);
|
||||
|
||||
protected:
|
||||
explicit ViENetworkImpl(ViESharedData* shared_data);
|
||||
|
@ -87,20 +87,6 @@ void ViEReceiver::RegisterSimulcastRtpRtcpModules(
|
||||
}
|
||||
}
|
||||
|
||||
void ViEReceiver::IncomingRTPPacket(const WebRtc_Word8* rtp_packet,
|
||||
const WebRtc_Word32 rtp_packet_length,
|
||||
const char* from_ip,
|
||||
const WebRtc_UWord16 from_port) {
|
||||
InsertRTPPacket(rtp_packet, rtp_packet_length);
|
||||
}
|
||||
|
||||
void ViEReceiver::IncomingRTCPPacket(const WebRtc_Word8* rtcp_packet,
|
||||
const WebRtc_Word32 rtcp_packet_length,
|
||||
const char* from_ip,
|
||||
const WebRtc_UWord16 from_port) {
|
||||
InsertRTCPPacket(rtcp_packet, rtcp_packet_length);
|
||||
}
|
||||
|
||||
int ViEReceiver::ReceivedRTPPacket(const void* rtp_packet,
|
||||
int rtp_packet_length) {
|
||||
if (!receiving_) {
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "engine_configurations.h" // NOLINT
|
||||
#include "modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||
#include "modules/udp_transport/interface/udp_transport.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h" // NOLINT
|
||||
#include "video_engine/vie_defines.h"
|
||||
@ -29,7 +28,7 @@ class RtpDump;
|
||||
class RtpRtcp;
|
||||
class VideoCodingModule;
|
||||
|
||||
class ViEReceiver : public UdpTransportData, public RtpData {
|
||||
class ViEReceiver : public RtpData {
|
||||
public:
|
||||
ViEReceiver(const int32_t channel_id, VideoCodingModule* module_vcm,
|
||||
RemoteBitrateEstimator* remote_bitrate_estimator);
|
||||
@ -48,16 +47,6 @@ class ViEReceiver : public UdpTransportData, public RtpData {
|
||||
int StartRTPDump(const char file_nameUTF8[1024]);
|
||||
int StopRTPDump();
|
||||
|
||||
// Implements UdpTransportData.
|
||||
virtual void IncomingRTPPacket(const WebRtc_Word8* rtp_packet,
|
||||
const WebRtc_Word32 rtp_packet_length,
|
||||
const char* from_ip,
|
||||
const WebRtc_UWord16 from_port);
|
||||
virtual void IncomingRTCPPacket(const WebRtc_Word8* rtcp_packet,
|
||||
const WebRtc_Word32 rtcp_packet_length,
|
||||
const char* from_ip,
|
||||
const WebRtc_UWord16 from_port);
|
||||
|
||||
// Receives packets from external transport.
|
||||
int ReceivedRTPPacket(const void* rtp_packet, int rtp_packet_length);
|
||||
int ReceivedRTCPPacket(const void* rtcp_packet, int rtcp_packet_length);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,9 +27,6 @@
|
||||
#include "webrtc/voice_engine/shared_data.h"
|
||||
#include "webrtc/voice_engine/voice_engine_defines.h"
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
#include "webrtc/modules/udp_transport/interface/udp_transport.h"
|
||||
#endif
|
||||
#ifdef WEBRTC_SRTP
|
||||
#include "SrtpModule.h"
|
||||
#endif
|
||||
@ -65,9 +62,6 @@ class Channel:
|
||||
public RtpData,
|
||||
public RtpFeedback,
|
||||
public RtcpFeedback,
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
public UdpTransportData, // receiving packet from sockets
|
||||
#endif
|
||||
public FileCallback, // receiving notification from file player & recorder
|
||||
public Transport,
|
||||
public RtpAudioFeedback,
|
||||
@ -181,9 +175,6 @@ public:
|
||||
int sampleTimeSeconds);
|
||||
WebRtc_Word32 GetPeriodicDeadOrAliveStatus(bool& enabled,
|
||||
int& sampleTimeSeconds);
|
||||
WebRtc_Word32 SendUDPPacket(const void* data, unsigned int length,
|
||||
int& transmittedBytes, bool useRtcpSocket);
|
||||
|
||||
// VoEFile
|
||||
int StartPlayingFileLocally(const char* fileName, const bool loop,
|
||||
const FileFormats format,
|
||||
@ -412,18 +403,6 @@ public:
|
||||
const WebRtc_UWord16 lengthMs,
|
||||
const WebRtc_UWord8 volume);
|
||||
|
||||
public:
|
||||
// From UdpTransportData in the Socket Transport module
|
||||
void IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket,
|
||||
const WebRtc_Word32 rtpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort);
|
||||
|
||||
void IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket,
|
||||
const WebRtc_Word32 rtcpPacketLength,
|
||||
const char* fromIP,
|
||||
const WebRtc_UWord16 fromPort);
|
||||
|
||||
public:
|
||||
// From Transport (called by the RTP/RTCP module)
|
||||
int SendPacket(int /*channel*/, const void *data, int len);
|
||||
@ -497,16 +476,6 @@ public:
|
||||
{
|
||||
return _outputAudioLevel.Level();
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
bool SendSocketsInitialized() const
|
||||
{
|
||||
return _socketTransportModule.SendSocketsInitialized();
|
||||
}
|
||||
bool ReceiveSocketsInitialized() const
|
||||
{
|
||||
return _socketTransportModule.ReceiveSocketsInitialized();
|
||||
}
|
||||
#endif
|
||||
WebRtc_UWord32 Demultiplex(const AudioFrame& audioFrame);
|
||||
WebRtc_UWord32 PrepareEncodeAndSend(int mixingFrequency);
|
||||
WebRtc_UWord32 EncodeAndSend();
|
||||
@ -535,10 +504,6 @@ private:
|
||||
private:
|
||||
scoped_ptr<RtpRtcp> _rtpRtcpModule;
|
||||
AudioCodingModule& _audioCodingModule;
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
WebRtc_UWord8 _numSocketThreads;
|
||||
UdpTransport& _socketTransportModule;
|
||||
#endif
|
||||
#ifdef WEBRTC_SRTP
|
||||
SrtpModule& _srtpModule;
|
||||
#endif
|
||||
|
@ -14,7 +14,6 @@
|
||||
// - Initialization and termination.
|
||||
// - Trace information on text files or via callbacks.
|
||||
// - Multi-channel support (mixing, sending to multiple destinations etc.).
|
||||
// - Call setup (port and address) for receiving and sending sides.
|
||||
//
|
||||
// To support other codecs than G.711, the VoECodec sub-API must be utilized.
|
||||
//
|
||||
@ -140,28 +139,6 @@ public:
|
||||
// Deletes an existing channel and releases the utilized resources.
|
||||
virtual int DeleteChannel(int channel) = 0;
|
||||
|
||||
// Sets the local receiver port and address for a specified
|
||||
// |channel| number.
|
||||
virtual int SetLocalReceiver(int channel, int port,
|
||||
int RTCPport = kVoEDefault,
|
||||
const char ipAddr[64] = NULL,
|
||||
const char multiCastAddr[64] = NULL) = 0;
|
||||
|
||||
// Gets the local receiver port and address for a specified
|
||||
// |channel| number.
|
||||
virtual int GetLocalReceiver(int channel, int& port, int& RTCPport,
|
||||
char ipAddr[64]) = 0;
|
||||
|
||||
// Sets the destination port and address for a specified |channel| number.
|
||||
virtual int SetSendDestination(int channel, int port,
|
||||
const char ipAddr[64],
|
||||
int sourcePort = kVoEDefault,
|
||||
int RTCPport = kVoEDefault) = 0;
|
||||
|
||||
// Gets the destination port and address for a specified |channel| number.
|
||||
virtual int GetSendDestination(int channel, int& port, char ipAddr[64],
|
||||
int& sourcePort, int& RTCPport) = 0;
|
||||
|
||||
// Prepares and initiates the VoiceEngine for reception of
|
||||
// incoming RTP/RTCP packets on the specified |channel|.
|
||||
virtual int StartReceive(int channel) = 0;
|
||||
|
@ -11,9 +11,6 @@
|
||||
// This sub-API supports the following functionalities:
|
||||
//
|
||||
// - External protocol support.
|
||||
// - Extended port and address APIs.
|
||||
// - Port and address filters.
|
||||
// - Windows GQoS functions.
|
||||
// - Packet timeout notification.
|
||||
// - Dead-or-Alive connection observations.
|
||||
// - Transmission of raw RTP/RTCP packets into existing channels.
|
||||
@ -93,49 +90,6 @@ public:
|
||||
virtual int ReceivedRTCPPacket(
|
||||
int channel, const void* data, unsigned int length) = 0;
|
||||
|
||||
// Gets the source ports and IP address of incoming packets on a
|
||||
// specific |channel|.
|
||||
virtual int GetSourceInfo(
|
||||
int channel, int& rtpPort, int& rtcpPort, char ipAddr[64]) = 0;
|
||||
|
||||
// Gets the local (host) IP address.
|
||||
virtual int GetLocalIP(char ipAddr[64], bool ipv6 = false) = 0;
|
||||
|
||||
// Enables IPv6 for a specified |channel|.
|
||||
virtual int EnableIPv6(int channel) = 0;
|
||||
|
||||
// Gets the current IPv6 staus for a specified |channel|.
|
||||
virtual bool IPv6IsEnabled(int channel) = 0;
|
||||
|
||||
// Enables a port and IP address filter for incoming packets on a
|
||||
// specific |channel|.
|
||||
virtual int SetSourceFilter(int channel,
|
||||
int rtpPort, int rtcpPort = 0, const char ipAddr[64] = 0) = 0;
|
||||
|
||||
// Gets the current port and IP-address filter for a specified |channel|.
|
||||
virtual int GetSourceFilter(
|
||||
int channel, int& rtpPort, int& rtcpPort, char ipAddr[64]) = 0;
|
||||
|
||||
// Sets the six-bit Differentiated Services Code Point (DSCP) in the
|
||||
// IP header of the outgoing stream for a specific |channel|.
|
||||
virtual int SetSendTOS(int channel,
|
||||
int DSCP, int priority = -1, bool useSetSockopt = false) = 0;
|
||||
|
||||
// Gets the six-bit DSCP in the IP header of the outgoing stream for
|
||||
// a specific channel.
|
||||
virtual int GetSendTOS(
|
||||
int channel, int& DSCP, int& priority, bool& useSetSockopt) = 0;
|
||||
|
||||
// Sets the Generic Quality of Service (GQoS) service level.
|
||||
// The Windows operating system then maps to a Differentiated Services
|
||||
// Code Point (DSCP) and to an 802.1p setting. [Windows only]
|
||||
virtual int SetSendGQoS(
|
||||
int channel, bool enable, int serviceType, int overrideDSCP = 0) = 0;
|
||||
|
||||
// Gets the Generic Quality of Service (GQoS) service level.
|
||||
virtual int GetSendGQoS(
|
||||
int channel, bool& enabled, int& serviceType, int& overrideDSCP) = 0;
|
||||
|
||||
// Enables or disables warnings that report if packets have not been
|
||||
// received in |timeoutSeconds| seconds for a specific |channel|.
|
||||
virtual int SetPacketTimeoutNotification(
|
||||
@ -161,12 +115,6 @@ public:
|
||||
virtual int GetPeriodicDeadOrAliveStatus(
|
||||
int channel, bool& enabled, int& sampleTimeSeconds) = 0;
|
||||
|
||||
// Handles sending a raw UDP data packet over an existing RTP or RTCP
|
||||
// socket.
|
||||
virtual int SendUDPPacket(
|
||||
int channel, const void* data, unsigned int length,
|
||||
int& transmittedBytes, bool useRtcpSocket = false) = 0;
|
||||
|
||||
protected:
|
||||
VoENetwork() {}
|
||||
virtual ~VoENetwork() {}
|
||||
|
@ -13,9 +13,30 @@
|
||||
|
||||
#include "before_initialization_fixture.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "webrtc/common_types.h"
|
||||
|
||||
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
|
||||
// done by the before-initialization fixture. It also registers an error
|
||||
// observer which will fail tests on error callbacks. This fixture is
|
||||
|
@ -12,8 +12,6 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
static const char* kLoopbackIp = "127.0.0.1";
|
||||
|
||||
AfterStreamingFixture::AfterStreamingFixture()
|
||||
: channel_(voe_base_->CreateChannel()) {
|
||||
EXPECT_GE(channel_, 0);
|
||||
@ -30,7 +28,9 @@ AfterStreamingFixture::~AfterStreamingFixture() {
|
||||
voe_file_->StopPlayingFileAsMicrophone(channel_);
|
||||
PausePlaying();
|
||||
|
||||
EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(channel_));
|
||||
voe_base_->DeleteChannel(channel_);
|
||||
delete transport_;
|
||||
}
|
||||
|
||||
void AfterStreamingFixture::SwitchToManualMicrophone() {
|
||||
@ -59,8 +59,8 @@ void AfterStreamingFixture::ResumePlaying() {
|
||||
}
|
||||
|
||||
void AfterStreamingFixture::SetUpLocalPlayback() {
|
||||
EXPECT_EQ(0, voe_base_->SetSendDestination(channel_, 8000, kLoopbackIp));
|
||||
EXPECT_EQ(0, voe_base_->SetLocalReceiver(0, 8000));
|
||||
transport_ = new LoopBackTransport(voe_network_);
|
||||
EXPECT_EQ(0, voe_network_->RegisterExternalTransport(channel_, *transport_));
|
||||
|
||||
webrtc::CodecInst codec;
|
||||
codec.channels = 1;
|
||||
|
@ -42,6 +42,8 @@ class AfterStreamingFixture : public AfterInitializationFixture {
|
||||
|
||||
private:
|
||||
void SetUpLocalPlayback();
|
||||
|
||||
LoopBackTransport* transport_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -32,7 +32,13 @@ class MixingTest : public AfterInitializationFixture {
|
||||
: input_filename_(test::OutputPath() + "mixing_test_input.pcm"),
|
||||
output_filename_(test::OutputPath() + "mixing_test_output.pcm") {
|
||||
}
|
||||
|
||||
void SetUp() {
|
||||
transport_ = new LoopBackTransport(voe_network_);
|
||||
}
|
||||
void TearDown() {
|
||||
delete transport_;
|
||||
}
|
||||
|
||||
// Creates and mixes |num_remote_streams| which play a file "as microphone"
|
||||
// with |num_local_streams| which play a file "locally", using a constant
|
||||
// amplitude of |input_value|. The local streams manifest as "anonymous"
|
||||
@ -165,8 +171,7 @@ class MixingTest : public AfterInitializationFixture {
|
||||
// Start up a single remote stream.
|
||||
void StartRemoteStream(int stream, const CodecInst& codec_inst, int port) {
|
||||
EXPECT_EQ(0, voe_codec_->SetRecPayloadType(stream, codec_inst));
|
||||
EXPECT_EQ(0, voe_base_->SetLocalReceiver(stream, port));
|
||||
EXPECT_EQ(0, voe_base_->SetSendDestination(stream, port, "127.0.0.1"));
|
||||
EXPECT_EQ(0, voe_network_->RegisterExternalTransport(stream, *transport_));
|
||||
EXPECT_EQ(0, voe_base_->StartReceive(stream));
|
||||
EXPECT_EQ(0, voe_base_->StartPlayout(stream));
|
||||
EXPECT_EQ(0, voe_codec_->SetSendCodec(stream, codec_inst));
|
||||
@ -180,12 +185,14 @@ class MixingTest : public AfterInitializationFixture {
|
||||
EXPECT_EQ(0, voe_base_->StopSend(streams[i]));
|
||||
EXPECT_EQ(0, voe_base_->StopPlayout(streams[i]));
|
||||
EXPECT_EQ(0, voe_base_->StopReceive(streams[i]));
|
||||
EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(streams[i]));
|
||||
EXPECT_EQ(0, voe_base_->DeleteChannel(streams[i]));
|
||||
}
|
||||
}
|
||||
|
||||
const std::string input_filename_;
|
||||
const std::string output_filename_;
|
||||
LoopBackTransport* transport_;
|
||||
};
|
||||
|
||||
// These tests assume a maximum of three mixed participants. We typically allow
|
||||
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "after_initialization_fixture.h"
|
||||
|
||||
class NetworkBeforeStreamingTest : public AfterInitializationFixture {
|
||||
protected:
|
||||
void SetUp() {
|
||||
channel_ = voe_base_->CreateChannel();
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
voe_base_->DeleteChannel(channel_);
|
||||
}
|
||||
|
||||
int channel_;
|
||||
};
|
||||
|
||||
TEST_F(NetworkBeforeStreamingTest,
|
||||
GetSourceInfoReturnsEmptyValuesForUnconfiguredChannel) {
|
||||
char src_ip[32] = "0.0.0.0";
|
||||
int src_rtp_port = 1234;
|
||||
int src_rtcp_port = 1235;
|
||||
|
||||
EXPECT_EQ(0, voe_network_->GetSourceInfo(
|
||||
channel_, src_rtp_port, src_rtcp_port, src_ip));
|
||||
EXPECT_EQ(0, src_rtp_port);
|
||||
EXPECT_EQ(0, src_rtcp_port);
|
||||
EXPECT_STRCASEEQ("", src_ip);
|
||||
}
|
||||
|
||||
TEST_F(NetworkBeforeStreamingTest,
|
||||
GetSourceFilterReturnsEmptyValuesForUnconfiguredChannel) {
|
||||
int filter_port = -1;
|
||||
int filter_port_rtcp = -1;
|
||||
char filter_ip[32] = "0.0.0.0";
|
||||
|
||||
EXPECT_EQ(0, voe_network_->GetSourceFilter(
|
||||
channel_, filter_port, filter_port_rtcp, filter_ip));
|
||||
|
||||
EXPECT_EQ(0, filter_port);
|
||||
EXPECT_EQ(0, filter_port_rtcp);
|
||||
EXPECT_STRCASEEQ("", filter_ip);
|
||||
}
|
||||
|
||||
TEST_F(NetworkBeforeStreamingTest, SetSourceFilterSucceeds) {
|
||||
EXPECT_EQ(0, voe_network_->SetSourceFilter(channel_, 0));
|
||||
}
|
@ -23,79 +23,6 @@ class NetworkTest : public AfterStreamingFixture {
|
||||
|
||||
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,
|
||||
CallsObserverOnTimeoutAndRestartWhenPacketTimeoutNotificationIsEnabled) {
|
||||
// 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();
|
||||
EXPECT_GE(second_channel_, 0);
|
||||
|
||||
EXPECT_EQ(0, voe_base_->SetSendDestination(
|
||||
second_channel_, 8002, "127.0.0.1"));
|
||||
EXPECT_EQ(0, voe_base_->SetLocalReceiver(
|
||||
second_channel_, 8002));
|
||||
transport_ = new LoopBackTransport(voe_network_);
|
||||
EXPECT_EQ(0, voe_network_->RegisterExternalTransport(second_channel_,
|
||||
*transport_));
|
||||
|
||||
EXPECT_EQ(0, voe_base_->StartReceive(second_channel_));
|
||||
EXPECT_EQ(0, voe_base_->StartPlayout(second_channel_));
|
||||
EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC(second_channel_, 5678));
|
||||
@ -115,10 +115,13 @@ class RtpRtcpTest : public AfterStreamingFixture {
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
EXPECT_EQ(0, voe_network_->DeRegisterExternalTransport(second_channel_));
|
||||
voe_base_->DeleteChannel(second_channel_);
|
||||
delete transport_;
|
||||
}
|
||||
|
||||
int second_channel_;
|
||||
LoopBackTransport* transport_;
|
||||
};
|
||||
|
||||
void RtcpAppHandler::OnApplicationDataReceived(
|
||||
|
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "voe_cpu_test.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@ -16,7 +18,8 @@
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
#include "voe_cpu_test.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/test/udp_transport/include/channel_transport.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
@ -45,6 +48,7 @@ int VoECpuTest::DoTest() {
|
||||
VoEFile* file = _mgr.FilePtr();
|
||||
VoECodec* codec = _mgr.CodecPtr();
|
||||
VoEAudioProcessing* apm = _mgr.APMPtr();
|
||||
VoENetwork* voe_network = _mgr.NetworkPtr();
|
||||
|
||||
int channel(-1);
|
||||
CodecInst isac;
|
||||
@ -59,8 +63,12 @@ int VoECpuTest::DoTest() {
|
||||
CHECK(base->Init());
|
||||
channel = base->CreateChannel();
|
||||
|
||||
CHECK(base->SetLocalReceiver(channel, 5566));
|
||||
CHECK(base->SetSendDestination(channel, 5566, "127.0.0.1"));
|
||||
scoped_ptr<VoiceChannelTransport> voice_socket_transport(
|
||||
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->SetSendCodec(channel, isac));
|
||||
|
||||
@ -86,7 +94,6 @@ int VoECpuTest::DoTest() {
|
||||
|
||||
base->DeleteChannel(channel);
|
||||
CHECK(base->Terminate());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,14 @@
|
||||
#define WEBRTC_VOICE_ENGINE_VOE_EXTENDED_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/udp_transport/include/channel_transport.h"
|
||||
|
||||
namespace voetest {
|
||||
|
||||
@ -425,20 +432,22 @@ class VoEExtendedTest : public VoiceEngineObserver,
|
||||
int TestRTP_RTCP();
|
||||
int TestVideoSync();
|
||||
int TestVolumeControl();
|
||||
public:
|
||||
|
||||
int ErrorCode() const {
|
||||
return _errCode;
|
||||
}
|
||||
void ClearErrorCode() {
|
||||
_errCode = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
// from VoiceEngineObserver
|
||||
void CallbackOnError(const int errCode, const int channel);
|
||||
void CallbackOnTrace(const TraceLevel level, const char* message, const int length);
|
||||
protected:
|
||||
|
||||
// from VoEConnectionObserver
|
||||
void OnPeriodicDeadOrAlive(const int channel, const bool alive);
|
||||
|
||||
private:
|
||||
void Play(int channel, unsigned int timeMillisec, bool addFileAsMicrophone = false,
|
||||
bool addTimeMarker = false);
|
||||
@ -448,12 +457,12 @@ class VoEExtendedTest : public VoiceEngineObserver,
|
||||
int RunMixingTest(int num_remote_channels, int num_local_channels,
|
||||
int16_t input_value, int16_t max_output_value,
|
||||
int16_t min_output_value);
|
||||
private:
|
||||
|
||||
VoETestManager& _mgr;
|
||||
private:
|
||||
int _errCode;
|
||||
bool _alive;
|
||||
bool _listening[32];
|
||||
scoped_ptr<webrtc::VoiceChannelTransport> voice_channel_transports_[32];
|
||||
bool _playing[32];
|
||||
bool _sending[32];
|
||||
};
|
||||
|
@ -23,10 +23,12 @@
|
||||
#endif
|
||||
|
||||
#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/thread_wrapper.h"
|
||||
#include "webrtc/test/udp_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
|
||||
|
||||
using namespace webrtc;
|
||||
@ -122,6 +124,7 @@ int VoEStressTest::StartStopTest() {
|
||||
|
||||
// Get sub-API pointers
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
VoENetwork* voe_network = _mgr.NetworkPtr();
|
||||
|
||||
// Set trace
|
||||
// VALIDATE_STRESS(base->SetTraceFileName(
|
||||
@ -147,9 +150,12 @@ int VoEStressTest::StartStopTest() {
|
||||
printf("Test will take approximately %d minutes. \n",
|
||||
numberOfLoops * loopSleep / 1000 / 60 + 1);
|
||||
|
||||
scoped_ptr<VoiceChannelTransport> voice_channel_transport(
|
||||
new VoiceChannelTransport(voe_network, 0));
|
||||
|
||||
for (i = 0; i < numberOfLoops; ++i) {
|
||||
VALIDATE_STRESS(base->SetLocalReceiver(0, 4800));
|
||||
VALIDATE_STRESS(base->SetSendDestination(0, 4800, "127.0.0.1"));
|
||||
voice_channel_transport->SetSendDestination("127.0.0.1", 4800);
|
||||
voice_channel_transport->SetLocalReceiver(4800);
|
||||
VALIDATE_STRESS(base->StartReceive(0));
|
||||
VALIDATE_STRESS(base->StartPlayout(0));
|
||||
VALIDATE_STRESS(base->StartSend(0));
|
||||
@ -162,8 +168,9 @@ int VoEStressTest::StartStopTest() {
|
||||
}
|
||||
ANL();
|
||||
|
||||
VALIDATE_STRESS(base->SetLocalReceiver(0, 4800));
|
||||
VALIDATE_STRESS(base->SetSendDestination(0, 4800, "127.0.0.1"));
|
||||
VALIDATE_STRESS(voice_channel_transport->SetSendDestination("127.0.0.1",
|
||||
4800));
|
||||
VALIDATE_STRESS(voice_channel_transport->SetLocalReceiver(4800));
|
||||
VALIDATE_STRESS(base->StartReceive(0));
|
||||
VALIDATE_STRESS(base->StartPlayout(0));
|
||||
VALIDATE_STRESS(base->StartSend(0));
|
||||
|
@ -248,13 +248,17 @@ int VoEUnitTest::StartMedia(int channel, int rtpPort, bool listen, bool playout,
|
||||
bool send, bool fileAsMic, bool localFile) {
|
||||
VoEBase* base = _mgr.BasePtr();
|
||||
VoEFile* file = _mgr.FilePtr();
|
||||
VoENetwork* voe_network = _mgr.NetworkPtr();
|
||||
|
||||
_listening[channel] = false;
|
||||
_playing[channel] = false;
|
||||
_sending[channel] = false;
|
||||
|
||||
CHECK(base->SetLocalReceiver(channel, rtpPort));
|
||||
CHECK(base->SetSendDestination(channel, rtpPort, "127.0.0.1"));
|
||||
voice_channel_transports_[channel].reset(
|
||||
new VoiceChannelTransport(voe_network, channel));
|
||||
|
||||
CHECK(voice_channel_transports_[channel]->SetLocalReceiver(rtpPort));
|
||||
CHECK(voice_channel_transports_[channel]->SetSendDestination("127.0.0.1",
|
||||
rtpPort));
|
||||
if (listen) {
|
||||
_listening[channel] = true;
|
||||
CHECK(base->StartReceive(channel));
|
||||
|
@ -11,7 +11,9 @@
|
||||
#ifndef 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/udp_transport/include/channel_transport.h"
|
||||
#include "webrtc/voice_engine/test/auto_test/voe_standard_test.h"
|
||||
|
||||
namespace voetest {
|
||||
|
||||
@ -57,6 +59,7 @@ class VoEUnitTest : public Encryption {
|
||||
bool _listening[32];
|
||||
bool _playing[32];
|
||||
bool _sending[32];
|
||||
scoped_ptr<webrtc::VoiceChannelTransport> voice_channel_transports_[32];
|
||||
|
||||
private:
|
||||
bool _extOnOff;
|
||||
|
@ -18,8 +18,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
#include "voe_errors.h"
|
||||
#include "voe_base.h"
|
||||
#include "voe_codec.h"
|
||||
@ -35,14 +33,15 @@
|
||||
#include "voe_network.h"
|
||||
#include "voe_neteq_stats.h"
|
||||
#include "engine_configurations.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/test/udp_transport/include/channel_transport.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
|
||||
// Enable this this flag to run this test with hard coded
|
||||
// IP/Port/codec and start test automatically with key input
|
||||
// it could be useful in repeat tests.
|
||||
//#define DEBUG
|
||||
|
||||
// #define EXTERNAL_TRANSPORT
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
#define VALIDATE \
|
||||
@ -70,29 +69,6 @@ VoENetEqStats* neteqst = NULL;
|
||||
|
||||
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 {
|
||||
public:
|
||||
virtual void CallbackOnError(const int channel, const int err_code);
|
||||
@ -270,44 +246,24 @@ void RunTest(std::string out_path) {
|
||||
cnt++;
|
||||
|
||||
int j = 0;
|
||||
#ifdef EXTERNAL_TRANSPORT
|
||||
my_transportation ch0transport;
|
||||
printf("Enabling external transport \n");
|
||||
netw->RegisterExternalTransport(0, ch0transport);
|
||||
#else
|
||||
char ip[64];
|
||||
#ifdef DEBUG
|
||||
strcpy(ip, "127.0.0.1");
|
||||
#else
|
||||
char localip[64];
|
||||
netw->GetLocalIP(localip);
|
||||
printf("local IP:%s\n", localip);
|
||||
|
||||
printf("1. 127.0.0.1 \n");
|
||||
printf("2. Specify IP \n");
|
||||
ASSERT_EQ(1, scanf("%i", &i));
|
||||
|
||||
if (1 == i)
|
||||
if (1 == i) {
|
||||
strcpy(ip, "127.0.0.1");
|
||||
else {
|
||||
} else {
|
||||
printf("Specify remote IP: ");
|
||||
ASSERT_EQ(1, scanf("%s", ip));
|
||||
}
|
||||
#endif
|
||||
|
||||
int colons(0);
|
||||
while (ip[j] != '\0' && j < 64 && !(colons = (ip[j++] == ':')))
|
||||
;
|
||||
if (colons) {
|
||||
printf("Enabling IPv6\n");
|
||||
res = netw->EnableIPv6(0);
|
||||
VALIDATE;
|
||||
}
|
||||
|
||||
int rPort;
|
||||
#ifdef DEBUG
|
||||
rPort=8500;
|
||||
#else
|
||||
int rPort = 8500;
|
||||
#ifndef DEBUG
|
||||
printf("Specify remote port (1=1234): ");
|
||||
ASSERT_EQ(1, scanf("%i", &rPort));
|
||||
if (1 == rPort)
|
||||
@ -315,23 +271,24 @@ void RunTest(std::string out_path) {
|
||||
printf("Set Send port \n");
|
||||
#endif
|
||||
|
||||
scoped_ptr<VoiceChannelTransport> voice_channel_transport(
|
||||
new VoiceChannelTransport(netw, chan));
|
||||
|
||||
printf("Set Send IP \n");
|
||||
res = base1->SetSendDestination(chan, rPort, ip);
|
||||
res = voice_channel_transport->SetSendDestination(ip, rPort);
|
||||
VALIDATE;
|
||||
|
||||
int lPort;
|
||||
#ifdef DEBUG
|
||||
lPort=8500;
|
||||
#else
|
||||
int lPort = 8500;
|
||||
#ifndef DEBUG
|
||||
printf("Specify local port (1=1234): ");
|
||||
ASSERT_EQ(1, scanf("%i", &lPort));
|
||||
if (1 == lPort)
|
||||
lPort = 1234;
|
||||
printf("Set Rec Port \n");
|
||||
#endif
|
||||
res = base1->SetLocalReceiver(chan, lPort);
|
||||
|
||||
res = voice_channel_transport->SetLocalReceiver(lPort);
|
||||
VALIDATE;
|
||||
#endif
|
||||
|
||||
printf("\n");
|
||||
for (i = 0; i < codec->NumOfCodecs(); i++) {
|
||||
@ -367,12 +324,19 @@ void RunTest(std::string out_path) {
|
||||
#endif
|
||||
int channel_index = 0;
|
||||
std::vector<int> channels(kMaxNumChannels);
|
||||
std::vector<scoped_ptr<VoiceChannelTransport> > voice_channel_transports;
|
||||
|
||||
for (i = 0; i < kMaxNumChannels; ++i) {
|
||||
channels[i] = base1->CreateChannel();
|
||||
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;
|
||||
res = base1->SetLocalReceiver(channels[i], port);
|
||||
res = voice_channel_transports[i]->SetLocalReceiver(port);
|
||||
VALIDATE;
|
||||
res = codec->SetSendCodec(channels[i], cinst);
|
||||
VALIDATE;
|
||||
|
@ -20,6 +20,7 @@
|
||||
'<(DEPTH)/testing/gmock.gyp:gmock',
|
||||
'<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags',
|
||||
'<(webrtc_root)/test/libtest/libtest.gyp:libtest',
|
||||
'<(webrtc_root)/test/udp_transport.gyp:udp_transport',
|
||||
],
|
||||
'include_dirs': [
|
||||
'auto_test',
|
||||
@ -59,7 +60,6 @@
|
||||
'auto_test/standard/mixing_test.cc',
|
||||
'auto_test/standard/neteq_stats_test.cc',
|
||||
'auto_test/standard/neteq_test.cc',
|
||||
'auto_test/standard/network_before_streaming_test.cc',
|
||||
'auto_test/standard/network_test.cc',
|
||||
'auto_test/standard/rtp_rtcp_before_streaming_test.cc',
|
||||
'auto_test/standard/rtp_rtcp_test.cc',
|
||||
@ -102,6 +102,7 @@
|
||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||
'voice_engine_core',
|
||||
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
||||
'<(webrtc_root)/test/udp_transport.gyp:udp_transport',
|
||||
],
|
||||
'sources': [
|
||||
'cmd_test/voe_cmd_test.cc',
|
||||
|
@ -683,265 +683,9 @@ int VoEBaseImpl::DeleteChannel(int channel)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int VoEBaseImpl::SetLocalReceiver(int channel, int port, int RTCPport,
|
||||
const char ipAddr[64],
|
||||
const char multiCastAddr[64])
|
||||
{
|
||||
// Inititialize local receive sockets (RTP and RTCP).
|
||||
//
|
||||
// The sockets are always first closed and then created again by this
|
||||
// function call. The created sockets are by default also used for
|
||||
// transmission (unless source port is set in SetSendDestination).
|
||||
//
|
||||
// Note that, sockets can also be created automatically if a user calls
|
||||
// SetSendDestination and StartSend without having called SetLocalReceiver
|
||||
// first. The sockets are then created at the first packet transmission.
|
||||
|
||||
CriticalSectionScoped cs(_shared->crit_sec());
|
||||
if (ipAddr == NULL && multiCastAddr == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"SetLocalReceiver(channel=%d, port=%d, RTCPport=%d)",
|
||||
channel, port, RTCPport);
|
||||
}
|
||||
else if (ipAddr != NULL && multiCastAddr == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"SetLocalReceiver(channel=%d, port=%d, RTCPport=%d, ipAddr=%s)",
|
||||
channel, port, RTCPport, ipAddr);
|
||||
}
|
||||
else if (ipAddr == NULL && multiCastAddr != NULL)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"SetLocalReceiver(channel=%d, port=%d, RTCPport=%d, "
|
||||
"multiCastAddr=%s)", channel, port, RTCPport, multiCastAddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"SetLocalReceiver(channel=%d, port=%d, RTCPport=%d, "
|
||||
"ipAddr=%s, multiCastAddr=%s)", channel, port, RTCPport, ipAddr,
|
||||
multiCastAddr);
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
if ((port < 0) || (port > 65535))
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_PORT_NMBR, kTraceError,
|
||||
"SetLocalReceiver() invalid RTP port");
|
||||
return -1;
|
||||
}
|
||||
if (((RTCPport != kVoEDefault) && (RTCPport < 0)) || ((RTCPport
|
||||
!= kVoEDefault) && (RTCPport > 65535)))
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_PORT_NMBR, kTraceError,
|
||||
"SetLocalReceiver() invalid RTCP port");
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"SetLocalReceiver() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Cast RTCP port. In the RTP module 0 corresponds to RTP port + 1 in
|
||||
// the module, which is the default.
|
||||
WebRtc_UWord16 rtcpPortUW16(0);
|
||||
if (RTCPport != kVoEDefault)
|
||||
{
|
||||
rtcpPortUW16 = static_cast<WebRtc_UWord16> (RTCPport);
|
||||
}
|
||||
|
||||
return channelPtr->SetLocalReceiver(port, rtcpPortUW16, ipAddr,
|
||||
multiCastAddr);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED,
|
||||
kTraceWarning, "SetLocalReceiver() VoE is built for external "
|
||||
"transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoEBaseImpl::GetLocalReceiver(int channel, int& port, int& RTCPport,
|
||||
char ipAddr[64])
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"GetLocalReceiver(channel=%d, ipAddr[]=?)", channel);
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"SetLocalReceiver() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
WebRtc_Word32 ret = channelPtr->GetLocalReceiver(port, RTCPport, ipAddr);
|
||||
if (ipAddr != NULL)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"GetLocalReceiver() => port=%d, RTCPport=%d, ipAddr=%s",
|
||||
port, RTCPport, ipAddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"GetLocalReceiver() => port=%d, RTCPport=%d", port, RTCPport);
|
||||
}
|
||||
return ret;
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"SetLocalReceiver() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoEBaseImpl::SetSendDestination(int channel, int port, const char* ipaddr,
|
||||
int sourcePort, int RTCPport)
|
||||
{
|
||||
WEBRTC_TRACE(
|
||||
kTraceApiCall,
|
||||
kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"SetSendDestination(channel=%d, port=%d, ipaddr=%s,"
|
||||
"sourcePort=%d, RTCPport=%d)",
|
||||
channel, port, ipaddr, sourcePort, RTCPport);
|
||||
CriticalSectionScoped cs(_shared->crit_sec());
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"SetSendDestination() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
if ((port < 0) || (port > 65535))
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_PORT_NMBR, kTraceError,
|
||||
"SetSendDestination() invalid RTP port");
|
||||
return -1;
|
||||
}
|
||||
if (((RTCPport != kVoEDefault) && (RTCPport < 0)) || ((RTCPport
|
||||
!= kVoEDefault) && (RTCPport > 65535)))
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_PORT_NMBR, kTraceError,
|
||||
"SetSendDestination() invalid RTCP port");
|
||||
return -1;
|
||||
}
|
||||
if (((sourcePort != kVoEDefault) && (sourcePort < 0)) || ((sourcePort
|
||||
!= kVoEDefault) && (sourcePort > 65535)))
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_PORT_NMBR, kTraceError,
|
||||
"SetSendDestination() invalid source port");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Cast RTCP port. In the RTP module 0 corresponds to RTP port + 1 in the
|
||||
// module, which is the default.
|
||||
WebRtc_UWord16 rtcpPortUW16(0);
|
||||
if (RTCPport != kVoEDefault)
|
||||
{
|
||||
rtcpPortUW16 = static_cast<WebRtc_UWord16> (RTCPport);
|
||||
WEBRTC_TRACE(
|
||||
kTraceInfo,
|
||||
kTraceVoice,
|
||||
VoEId(_shared->instance_id(), channel),
|
||||
"SetSendDestination() non default RTCP port %u will be "
|
||||
"utilized",
|
||||
rtcpPortUW16);
|
||||
}
|
||||
|
||||
return channelPtr->SetSendDestination(port, ipaddr, sourcePort,
|
||||
rtcpPortUW16);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"SetSendDestination() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoEBaseImpl::GetSendDestination(int channel, int& port, char ipAddr[64],
|
||||
int& sourcePort, int& RTCPport)
|
||||
{
|
||||
WEBRTC_TRACE(
|
||||
kTraceApiCall,
|
||||
kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"GetSendDestination(channel=%d, ipAddr[]=?, sourcePort=?,"
|
||||
"RTCPport=?)",
|
||||
channel);
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"GetSendDestination() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
WebRtc_Word32 ret = channelPtr->GetSendDestination(port, ipAddr,
|
||||
sourcePort, RTCPport);
|
||||
if (ipAddr != NULL)
|
||||
{
|
||||
WEBRTC_TRACE(
|
||||
kTraceStateInfo,
|
||||
kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"GetSendDestination() => port=%d, RTCPport=%d, ipAddr=%s, "
|
||||
"sourcePort=%d, RTCPport=%d",
|
||||
port, RTCPport, ipAddr, sourcePort, RTCPport);
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(
|
||||
kTraceStateInfo,
|
||||
kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"GetSendDestination() => port=%d, RTCPport=%d, "
|
||||
"sourcePort=%d, RTCPport=%d",
|
||||
port, RTCPport, sourcePort, RTCPport);
|
||||
}
|
||||
return ret;
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"GetSendDestination() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoEBaseImpl::StartReceive(int channel)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
@ -1064,15 +808,6 @@ int VoEBaseImpl::StartSend(int channel)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!channelPtr->ExternalTransport()
|
||||
&& !channelPtr->SendSocketsInitialized())
|
||||
{
|
||||
_shared->SetLastError(VE_DESTINATION_NOT_INITED, kTraceError,
|
||||
"StartSend() must set send destination first");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if (StartSend() != 0)
|
||||
{
|
||||
_shared->SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR, kTraceError,
|
||||
@ -1145,16 +880,6 @@ int VoEBaseImpl::GetVersion(char version[1024])
|
||||
accLen += len;
|
||||
assert(accLen < kVoiceEngineVersionMaxMessageSize);
|
||||
|
||||
#ifdef WEBRTC_EXTERNAL_TRANSPORT
|
||||
len = AddExternalTransportBuild(versionPtr);
|
||||
if (len == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
versionPtr += len;
|
||||
accLen += len;
|
||||
assert(accLen < kVoiceEngineVersionMaxMessageSize);
|
||||
#endif
|
||||
#ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT
|
||||
len = AddExternalRecAndPlayoutBuild(versionPtr);
|
||||
if (len == -1)
|
||||
@ -1207,13 +932,6 @@ WebRtc_Word32 VoEBaseImpl::AddVoEVersion(char* str) const
|
||||
return sprintf(str, "VoiceEngine 4.1.0\n");
|
||||
}
|
||||
|
||||
#ifdef WEBRTC_EXTERNAL_TRANSPORT
|
||||
WebRtc_Word32 VoEBaseImpl::AddExternalTransportBuild(char* str) const
|
||||
{
|
||||
return sprintf(str, "External transport build\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT
|
||||
WebRtc_Word32 VoEBaseImpl::AddExternalRecAndPlayoutBuild(char* str) const
|
||||
{
|
||||
|
@ -44,25 +44,6 @@ public:
|
||||
|
||||
virtual int DeleteChannel(int channel);
|
||||
|
||||
virtual int SetLocalReceiver(int channel, int port,
|
||||
int RTCPport = kVoEDefault,
|
||||
const char ipAddr[64] = NULL,
|
||||
const char multiCastAddr[64] = NULL);
|
||||
|
||||
virtual int GetLocalReceiver(int channel, int& port, int& RTCPport,
|
||||
char ipAddr[64]);
|
||||
|
||||
virtual int SetSendDestination(int channel, int port,
|
||||
const char ipAddr[64],
|
||||
int sourcePort = kVoEDefault,
|
||||
int RTCPport = kVoEDefault);
|
||||
|
||||
virtual int GetSendDestination(int channel,
|
||||
int& port,
|
||||
char ipAddr[64],
|
||||
int& sourcePort,
|
||||
int& RTCPport);
|
||||
|
||||
virtual int StartReceive(int channel);
|
||||
|
||||
virtual int StartPlayout(int channel);
|
||||
@ -125,9 +106,6 @@ private:
|
||||
|
||||
WebRtc_Word32 AddBuildInfo(char* str) const;
|
||||
WebRtc_Word32 AddVoEVersion(char* str) const;
|
||||
#ifdef WEBRTC_EXTERNAL_TRANSPORT
|
||||
WebRtc_Word32 AddExternalTransportBuild(char* str) const;
|
||||
#endif
|
||||
#ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT
|
||||
WebRtc_Word32 AddExternalRecAndPlayoutBuild(char* str) const;
|
||||
#endif
|
||||
@ -139,7 +117,6 @@ private:
|
||||
WebRtc_UWord32 _oldMicLevel;
|
||||
AudioFrame _audioFrame;
|
||||
voe::SharedData* _shared;
|
||||
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -170,504 +170,6 @@ int VoENetworkImpl::ReceivedRTCPPacket(int channel, const void* data,
|
||||
return channelPtr->ReceivedRTCPPacket((const WebRtc_Word8*) data, length);
|
||||
}
|
||||
|
||||
int VoENetworkImpl::GetSourceInfo(int channel,
|
||||
int& rtpPort,
|
||||
int& rtcpPort,
|
||||
char ipAddr[64])
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"GetSourceInfo(channel=%d, rtpPort=?, rtcpPort=?, ipAddr[]=?)",
|
||||
channel);
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
if (NULL == ipAddr)
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
||||
"GetSourceInfo() invalid IP-address buffer");
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"GetSourceInfo() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
if (channelPtr->ExternalTransport())
|
||||
{
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
|
||||
"GetSourceInfo() external transport is enabled");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->GetSourceInfo(rtpPort, rtcpPort, ipAddr);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"GetSourceInfo() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoENetworkImpl::GetLocalIP(char ipAddr[64], bool ipv6)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"GetLocalIP(ipAddr[]=?, ipv6=%d)", ipv6);
|
||||
IPHONE_NOT_SUPPORTED(_shared->statistics());
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
if (NULL == ipAddr)
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
||||
"GetLocalIP() invalid IP-address buffer");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Create a temporary socket module to ensure that this method can be
|
||||
// called also when no channels are created.
|
||||
WebRtc_UWord8 numSockThreads(1);
|
||||
UdpTransport* socketPtr =
|
||||
UdpTransport::Create(
|
||||
-1,
|
||||
numSockThreads);
|
||||
if (NULL == socketPtr)
|
||||
{
|
||||
_shared->SetLastError(VE_SOCKET_TRANSPORT_MODULE_ERROR, kTraceError,
|
||||
"GetLocalIP() failed to create socket module");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Use a buffer big enough for IPv6 addresses and initialize it with zeros.
|
||||
char localIPAddr[256] = {0};
|
||||
|
||||
if (ipv6)
|
||||
{
|
||||
char localIP[16];
|
||||
if (socketPtr->LocalHostAddressIPV6(localIP) != 0)
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_IP_ADDRESS, kTraceError,
|
||||
"GetLocalIP() failed to retrieve local IP - 1");
|
||||
UdpTransport::Destroy(socketPtr);
|
||||
return -1;
|
||||
}
|
||||
// Convert 128-bit address to character string (a:b:c:d:e:f:g:h)
|
||||
sprintf(localIPAddr,
|
||||
"%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x"
|
||||
"%.2x:%.2x%.2x",
|
||||
localIP[0], localIP[1], localIP[2], localIP[3], localIP[4],
|
||||
localIP[5], localIP[6], localIP[7], localIP[8], localIP[9],
|
||||
localIP[10], localIP[11], localIP[12], localIP[13],
|
||||
localIP[14], localIP[15]);
|
||||
}
|
||||
else
|
||||
{
|
||||
WebRtc_UWord32 localIP(0);
|
||||
// Read local IP (as 32-bit address) from the socket module
|
||||
if (socketPtr->LocalHostAddress(localIP) != 0)
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_IP_ADDRESS, kTraceError,
|
||||
"GetLocalIP() failed to retrieve local IP - 2");
|
||||
UdpTransport::Destroy(socketPtr);
|
||||
return -1;
|
||||
}
|
||||
// Convert 32-bit address to character string (x.y.z.w)
|
||||
sprintf(localIPAddr, "%d.%d.%d.%d", (int) ((localIP >> 24) & 0x0ff),
|
||||
(int) ((localIP >> 16) & 0x0ff),
|
||||
(int) ((localIP >> 8) & 0x0ff),
|
||||
(int) (localIP & 0x0ff));
|
||||
}
|
||||
|
||||
strcpy(ipAddr, localIPAddr);
|
||||
|
||||
UdpTransport::Destroy(socketPtr);
|
||||
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"GetLocalIP() => ipAddr=%s", ipAddr);
|
||||
return 0;
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"GetLocalIP() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoENetworkImpl::EnableIPv6(int channel)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"EnableIPv6(channel=%d)", channel);
|
||||
ANDROID_NOT_SUPPORTED(_shared->statistics());
|
||||
IPHONE_NOT_SUPPORTED(_shared->statistics());
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"EnableIPv6() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
if (channelPtr->ExternalTransport())
|
||||
{
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
|
||||
"EnableIPv6() external transport is enabled");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->EnableIPv6();
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"EnableIPv6() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VoENetworkImpl::IPv6IsEnabled(int channel)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"IPv6IsEnabled(channel=%d)", channel);
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return false;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"IPv6IsEnabled() failed to locate channel");
|
||||
return false;
|
||||
}
|
||||
if (channelPtr->ExternalTransport())
|
||||
{
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
|
||||
"IPv6IsEnabled() external transport is enabled");
|
||||
return false;
|
||||
}
|
||||
return channelPtr->IPv6IsEnabled();
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"IPv6IsEnabled() VoE is built for external transport");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoENetworkImpl::SetSourceFilter(int channel,
|
||||
int rtpPort,
|
||||
int rtcpPort,
|
||||
const char ipAddr[64])
|
||||
{
|
||||
(ipAddr == NULL) ? WEBRTC_TRACE(kTraceApiCall, kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"SetSourceFilter(channel=%d, rtpPort=%d,"
|
||||
" rtcpPort=%d)",
|
||||
channel, rtpPort, rtcpPort)
|
||||
: WEBRTC_TRACE(kTraceApiCall, kTraceVoice,
|
||||
VoEId(_shared->instance_id(), -1),
|
||||
"SetSourceFilter(channel=%d, rtpPort=%d,"
|
||||
" rtcpPort=%d, ipAddr=%s)",
|
||||
channel, rtpPort, rtcpPort, ipAddr);
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
if ((rtpPort < 0) || (rtpPort > 65535))
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_PORT_NMBR, kTraceError,
|
||||
"SetSourceFilter() invalid RTP port");
|
||||
return -1;
|
||||
}
|
||||
if ((rtcpPort < 0) || (rtcpPort > 65535))
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_PORT_NMBR, kTraceError,
|
||||
"SetSourceFilter() invalid RTCP port");
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"SetSourceFilter() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
if (channelPtr->ExternalTransport())
|
||||
{
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
|
||||
"SetSourceFilter() external transport is enabled");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->SetSourceFilter(rtpPort, rtcpPort, ipAddr);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"SetSourceFilter() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoENetworkImpl::GetSourceFilter(int channel,
|
||||
int& rtpPort,
|
||||
int& rtcpPort,
|
||||
char ipAddr[64])
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"GetSourceFilter(channel=%d, rtpPort=?, rtcpPort=?, "
|
||||
"ipAddr[]=?)",
|
||||
channel);
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
if (NULL == ipAddr)
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
||||
"GetSourceFilter() invalid IP-address buffer");
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"GetSourceFilter() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
if (channelPtr->ExternalTransport())
|
||||
{
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
|
||||
"GetSourceFilter() external transport is enabled");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->GetSourceFilter(rtpPort, rtcpPort, ipAddr);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"GetSourceFilter() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoENetworkImpl::SetSendTOS(int channel,
|
||||
int DSCP,
|
||||
int priority,
|
||||
bool useSetSockopt)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"SetSendTOS(channel=%d, DSCP=%d, useSetSockopt=%d)",
|
||||
channel, DSCP, useSetSockopt);
|
||||
|
||||
#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_MAC)
|
||||
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning,
|
||||
"SetSendTOS() is not supported on this platform");
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
if ((DSCP < 0) || (DSCP > 63))
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
||||
"SetSendTOS() Invalid DSCP value");
|
||||
return -1;
|
||||
}
|
||||
#if defined(_WIN32) || defined(WEBRTC_LINUX)
|
||||
if ((priority < -1) || (priority > 7))
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
||||
"SetSendTOS() Invalid priority value");
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
if (-1 != priority)
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
||||
"SetSendTOS() priority not supported");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#if defined(_WIN32)
|
||||
if ((priority >= 0) && useSetSockopt)
|
||||
{
|
||||
// On Windows, priority and useSetSockopt cannot be combined
|
||||
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
||||
"SetSendTOS() priority and useSetSockopt conflict");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"SetSendTOS() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
if (channelPtr->ExternalTransport())
|
||||
{
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
|
||||
"SetSendTOS() external transport is enabled");
|
||||
return -1;
|
||||
}
|
||||
#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
|
||||
useSetSockopt = true;
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
" force useSetSockopt=true since there is no alternative"
|
||||
" implementation");
|
||||
#endif
|
||||
|
||||
return channelPtr->SetSendTOS(DSCP, priority, useSetSockopt);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"SetSendTOS() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoENetworkImpl::GetSendTOS(int channel,
|
||||
int& DSCP,
|
||||
int& priority,
|
||||
bool& useSetSockopt)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"GetSendTOS(channel=%d)", channel);
|
||||
|
||||
#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_MAC)
|
||||
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning,
|
||||
"GetSendTOS() is not supported on this platform");
|
||||
return -1;
|
||||
#endif
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"GetSendTOS() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
if (channelPtr->ExternalTransport())
|
||||
{
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
|
||||
"GetSendTOS() external transport is enabled");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->GetSendTOS(DSCP, priority, useSetSockopt);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"GetSendTOS() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoENetworkImpl::SetSendGQoS(int channel,
|
||||
bool enable,
|
||||
int serviceType,
|
||||
int overrideDSCP)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"SetSendGQOS(channel=%d, enable=%d, serviceType=%d,"
|
||||
" overrideDSCP=%d)",
|
||||
channel, (int) enable, serviceType, overrideDSCP);
|
||||
ANDROID_NOT_SUPPORTED(_shared->statistics());
|
||||
IPHONE_NOT_SUPPORTED(_shared->statistics());
|
||||
#if !defined(_WIN32)
|
||||
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning,
|
||||
"SetSendGQOS() is not supported on this platform");
|
||||
return -1;
|
||||
#elif !defined(WEBRTC_EXTERNAL_TRANSPORT)
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"SetSendGQOS() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
if (channelPtr->ExternalTransport())
|
||||
{
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
|
||||
"SetSendGQOS() external transport is enabled");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->SetSendGQoS(enable, serviceType, overrideDSCP);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"SetSendGQOS() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoENetworkImpl::GetSendGQoS(int channel,
|
||||
bool& enabled,
|
||||
int& serviceType,
|
||||
int& overrideDSCP)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"GetSendGQOS(channel=%d)", channel);
|
||||
ANDROID_NOT_SUPPORTED(_shared->statistics());
|
||||
IPHONE_NOT_SUPPORTED(_shared->statistics());
|
||||
#if !defined(_WIN32)
|
||||
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning,
|
||||
"GetSendGQOS() is not supported on this platform");
|
||||
return -1;
|
||||
#elif !defined(WEBRTC_EXTERNAL_TRANSPORT)
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"GetSendGQOS() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
if (channelPtr->ExternalTransport())
|
||||
{
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
|
||||
"GetSendGQOS() external transport is enabled");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->GetSendGQoS(enabled, serviceType, overrideDSCP);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"GetSendGQOS() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoENetworkImpl::SetPacketTimeoutNotification(int channel,
|
||||
bool enable,
|
||||
int timeoutSeconds)
|
||||
@ -821,52 +323,6 @@ int VoENetworkImpl::GetPeriodicDeadOrAliveStatus(int channel,
|
||||
sampleTimeSeconds);
|
||||
}
|
||||
|
||||
int VoENetworkImpl::SendUDPPacket(int channel,
|
||||
const void* data,
|
||||
unsigned int length,
|
||||
int& transmittedBytes,
|
||||
bool useRtcpSocket)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"SendUDPPacket(channel=%d, data=0x%x, length=%u, useRTCP=%d)",
|
||||
channel, data, length, useRtcpSocket);
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
if (NULL == data)
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
||||
"SendUDPPacket() invalid data buffer");
|
||||
return -1;
|
||||
}
|
||||
if (0 == length)
|
||||
{
|
||||
_shared->SetLastError(VE_INVALID_PACKET, kTraceError,
|
||||
"SendUDPPacket() invalid packet size");
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"SendUDPPacket() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->SendUDPPacket(data,
|
||||
length,
|
||||
transmittedBytes,
|
||||
useRtcpSocket);
|
||||
#else
|
||||
_shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceWarning,
|
||||
"SendUDPPacket() VoE is built for external transport");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // WEBRTC_VOICE_ENGINE_NETWORK_API
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -34,47 +34,6 @@ public:
|
||||
const void* data,
|
||||
unsigned int length);
|
||||
|
||||
virtual int GetSourceInfo(int channel,
|
||||
int& rtpPort,
|
||||
int& rtcpPort,
|
||||
char ipAddr[64]);
|
||||
|
||||
virtual int GetLocalIP(char ipAddr[64], bool ipv6 = false);
|
||||
|
||||
virtual int EnableIPv6(int channel);
|
||||
|
||||
virtual bool IPv6IsEnabled(int channel);
|
||||
|
||||
virtual int SetSourceFilter(int channel,
|
||||
int rtpPort,
|
||||
int rtcpPort,
|
||||
const char ipAddr[64] = 0);
|
||||
|
||||
virtual int GetSourceFilter(int channel,
|
||||
int& rtpPort,
|
||||
int& rtcpPort,
|
||||
char ipAddr[64]);
|
||||
|
||||
virtual int SetSendTOS(int channel,
|
||||
int DSCP,
|
||||
int priority = -1,
|
||||
bool useSetSockopt = false);
|
||||
|
||||
virtual int GetSendTOS(int channel,
|
||||
int& DSCP,
|
||||
int& priority,
|
||||
bool& useSetSockopt);
|
||||
|
||||
virtual int SetSendGQoS(int channel,
|
||||
bool enable,
|
||||
int serviceType,
|
||||
int overrideDSCP);
|
||||
|
||||
virtual int GetSendGQoS(int channel,
|
||||
bool& enabled,
|
||||
int& serviceType,
|
||||
int& overrideDSCP);
|
||||
|
||||
virtual int SetPacketTimeoutNotification(int channel,
|
||||
bool enable,
|
||||
int timeoutSeconds = 2);
|
||||
@ -96,12 +55,6 @@ public:
|
||||
bool& enabled,
|
||||
int& sampleTimeSeconds);
|
||||
|
||||
virtual int SendUDPPacket(int channel,
|
||||
const void* data,
|
||||
unsigned int length,
|
||||
int& transmittedBytes,
|
||||
bool useRtcpSocket = false);
|
||||
|
||||
protected:
|
||||
VoENetworkImpl(voe::SharedData* shared);
|
||||
virtual ~VoENetworkImpl();
|
||||
|
@ -20,7 +20,6 @@
|
||||
'<(webrtc_root)/modules/modules.gyp:audio_processing',
|
||||
'<(webrtc_root)/modules/modules.gyp:media_file',
|
||||
'<(webrtc_root)/modules/modules.gyp:rtp_rtcp',
|
||||
'<(webrtc_root)/modules/modules.gyp:udp_transport',
|
||||
'<(webrtc_root)/modules/modules.gyp:webrtc_utility',
|
||||
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
||||
],
|
||||
@ -134,7 +133,6 @@
|
||||
'<(webrtc_root)/modules/modules.gyp:audio_conference_mixer',
|
||||
'<(webrtc_root)/modules/modules.gyp:media_file',
|
||||
'<(webrtc_root)/modules/modules.gyp:rtp_rtcp',
|
||||
'<(webrtc_root)/modules/modules.gyp:udp_transport',
|
||||
'<(webrtc_root)/modules/modules.gyp:webrtc_utility',
|
||||
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user