Remove UDP transport API from VoE
Review URL: https://webrtc-codereview.appspot.com/1236004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3757 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
0746ce1465
commit
0c45957e3a
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_DTMF_DETECTION
|
||||
#include "voe_dtmf.h" // TelephoneEventDetectionMethods, TelephoneEventObserver
|
||||
#endif
|
||||
@ -62,9 +59,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,
|
||||
@ -103,19 +97,6 @@ public:
|
||||
WebRtc_Word32 StartReceiving();
|
||||
WebRtc_Word32 StopReceiving();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
WebRtc_Word32 SetLocalReceiver(const WebRtc_UWord16 rtpPort,
|
||||
const WebRtc_UWord16 rtcpPort,
|
||||
const char ipAddr[64],
|
||||
const char multicastIpAddr[64]);
|
||||
WebRtc_Word32 GetLocalReceiver(int& port, int& RTCPport, char ipAddr[]);
|
||||
WebRtc_Word32 SetSendDestination(const WebRtc_UWord16 rtpPort,
|
||||
const char ipAddr[64],
|
||||
const int sourcePort,
|
||||
const WebRtc_UWord16 rtcpPort);
|
||||
WebRtc_Word32 GetSendDestination(int& port, char ipAddr[64],
|
||||
int& sourcePort, int& RTCPport);
|
||||
#endif
|
||||
WebRtc_Word32 SetNetEQPlayoutMode(NetEqModes mode);
|
||||
WebRtc_Word32 GetNetEQPlayoutMode(NetEqModes& mode);
|
||||
WebRtc_Word32 SetOnHoldStatus(bool enable, OnHoldModes mode);
|
||||
@ -154,21 +135,6 @@ public:
|
||||
WebRtc_Word32 length);
|
||||
WebRtc_Word32 ReceivedRTCPPacket(const WebRtc_Word8* data,
|
||||
WebRtc_Word32 length);
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
WebRtc_Word32 GetSourceInfo(int& rtpPort, int& rtcpPort, char ipAddr[64]);
|
||||
WebRtc_Word32 EnableIPv6();
|
||||
bool IPv6IsEnabled() const;
|
||||
WebRtc_Word32 SetSourceFilter(int rtpPort, int rtcpPort,
|
||||
const char ipAddr[64]);
|
||||
WebRtc_Word32 GetSourceFilter(int& rtpPort, int& rtcpPort, char ipAddr[64]);
|
||||
WebRtc_Word32 SetSendTOS(int DSCP, int priority, bool useSetSockopt);
|
||||
WebRtc_Word32 GetSendTOS(int &DSCP, int& priority, bool &useSetSockopt);
|
||||
#if defined(_WIN32)
|
||||
WebRtc_Word32 SetSendGQoS(bool enable, int serviceType, int overrideDSCP);
|
||||
WebRtc_Word32 GetSendGQoS(bool &enabled, int &serviceType,
|
||||
int &overrideDSCP);
|
||||
#endif
|
||||
#endif
|
||||
WebRtc_Word32 SetPacketTimeoutNotification(bool enable, int timeoutSeconds);
|
||||
WebRtc_Word32 GetPacketTimeoutNotification(bool& enabled,
|
||||
int& timeoutSeconds);
|
||||
@ -178,8 +144,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,
|
||||
@ -387,18 +351,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);
|
||||
@ -472,16 +424,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();
|
||||
@ -510,10 +452,6 @@ private:
|
||||
private:
|
||||
scoped_ptr<RtpRtcp> _rtpRtcpModule;
|
||||
AudioCodingModule& _audioCodingModule;
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
WebRtc_UWord8 _numSocketThreads;
|
||||
UdpTransport& _socketTransportModule;
|
||||
#endif
|
||||
RtpDump& _rtpDumpIn;
|
||||
RtpDump& _rtpDumpOut;
|
||||
private:
|
||||
|
@ -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,12 +11,8 @@
|
||||
// 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.
|
||||
//
|
||||
// Usage example, omitting error checking:
|
||||
//
|
||||
@ -93,49 +89,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 +114,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() {}
|
||||
|
@ -32,6 +32,12 @@ 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
|
||||
@ -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));
|
||||
}
|
@ -60,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',
|
||||
|
@ -687,261 +687,6 @@ int VoEBaseImpl::DeleteChannel(int channel)
|
||||
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 +809,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,
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user