Remove UDP transport API from ViE

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3754 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org 2013-04-02 20:37:14 +00:00
parent 7b859cc1e9
commit 82dcc9ff11
12 changed files with 67 additions and 1405 deletions

View File

@ -70,34 +70,6 @@ class WEBRTC_DLLEXPORT ViENetwork {
virtual void SetNetworkTransmissionState(const int video_channel,
const bool is_transmitting) = 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,
@ -119,63 +91,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 sixbit 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 sixbit 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.
@ -202,14 +117,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() {}

View File

@ -34,6 +34,9 @@
#include "common_types.h"
#include "android_media_codec_decoder.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/test/channel_transport/include/channel_transport.h"
#define WEBRTC_LOG_TAG "*WEBRTCN*"
#define VALIDATE_BASE_POINTER \
if (!voeData.base) \
@ -106,7 +109,9 @@ typedef struct
VoEVolumeControl* volume;
VoEHardware* hardware;
VoERTP_RTCP* rtp;
JavaVM* jvm;
scoped_ptr<test::VoiceChannelTransport> transport;
} VoiceEngineData;
class AndroidVideoRenderCallback;
@ -121,7 +126,9 @@ typedef struct
ViERender* render;
ViECapture* capture;
ViEExternalCodec* externalCodec;
VideoCallbackAndroid* callback;
scoped_ptr<test::VideoChannelTransport> transport;
} VideoEngineData;
// Global variables
@ -588,6 +595,8 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_CreateCh
if (voiceChannel >= 0) {
vieData.base->ConnectAudioChannel(channel, voiceChannel);
}
vieData.transport.reset(new test::VideoChannelTransport(vieData.netw,
channel));
return channel;
}
else {
@ -608,14 +617,9 @@ 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;
if (vieData.transport.get()) {
return vieData.transport->SetLocalReceiver(port);
}
else {
return -1;
}
return -1;
}
@ -646,7 +650,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,6 +1271,8 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Cre
}
jint channel = voeData.base->CreateChannel();
voeData.transport.reset(new test::VoiceChannelTransport(voeData.netw,
channel));
return channel;
}
@ -1278,6 +1287,7 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Del
jint channel)
{
VALIDATE_BASE_POINTER;
voeData.transport.reset(NULL);
return voeData.base->DeleteChannel(channel);
}
@ -1294,7 +1304,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;
}
/*
@ -1318,9 +1331,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 -1;
}
/*

View File

@ -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

View File

@ -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;

View File

@ -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_);
@ -234,9 +226,6 @@ ViEChannel::~ViEChannel() {
StopDecodeThread();
}
// Release modules.
#ifndef WEBRTC_EXTERNAL_TRANSPORT
UdpTransport::Destroy(&socket_transport_);
#endif
VideoCodingModule::Destroy(&vcm_);
}
@ -1288,265 +1277,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
rtp_rtcp_->SetSendingMediaStatus(true);
if (rtp_rtcp_->Sending()) {
@ -1615,40 +1355,14 @@ 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;
}
vie_receiver_.StartReceive();
return 0;
}
@ -1659,94 +1373,13 @@ 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__);
@ -1810,238 +1443,6 @@ WebRtc_Word32 ViEChannel::ReceivedRTCPPacket(
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 +1553,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);
@ -2515,15 +1887,9 @@ 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;
}
}
}
void ViEChannel::OnReceivedPacket(const WebRtc_Word32 id,

View File

@ -13,21 +13,20 @@
#include <list>
#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"
#include "typedefs.h" // NOLINT
#include "video_engine/include/vie_network.h"
#include "video_engine/include/vie_rtp_rtcp.h"
#include "video_engine/vie_defines.h"
#include "video_engine/vie_file_recorder.h"
#include "video_engine/vie_frame_provider_base.h"
#include "video_engine/vie_receiver.h"
#include "video_engine/vie_sender.h"
#include "video_engine/vie_sync_module.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/typedefs.h"
#include "webrtc/video_engine/include/vie_network.h"
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
#include "webrtc/video_engine/vie_defines.h"
#include "webrtc/video_engine/vie_file_recorder.h"
#include "webrtc/video_engine/vie_frame_provider_base.h"
#include "webrtc/video_engine/vie_receiver.h"
#include "webrtc/video_engine/vie_sender.h"
#include "webrtc/video_engine/vie_sync_module.h"
namespace webrtc {
@ -248,7 +247,6 @@ class ViEChannel
bool Sending();
WebRtc_Word32 StartReceive();
WebRtc_Word32 StopReceive();
bool Receiving();
WebRtc_Word32 RegisterSendTransport(Transport* transport);
WebRtc_Word32 DeregisterSendTransport();
@ -261,25 +259,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 +277,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 +358,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_;

View File

@ -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) {

View File

@ -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

View File

@ -8,22 +8,22 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "video_engine/vie_network_impl.h"
#include "webrtc/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"
#include "video_engine/vie_channel.h"
#include "video_engine/vie_channel_manager.h"
#include "video_engine/vie_defines.h"
#include "video_engine/vie_encoder.h"
#include "video_engine/vie_impl.h"
#include "video_engine/vie_shared_data.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/system_wrappers/interface/trace.h"
#include "webrtc/video_engine/include/vie_errors.h"
#include "webrtc/video_engine/vie_channel.h"
#include "webrtc/video_engine/vie_channel_manager.h"
#include "webrtc/video_engine/vie_defines.h"
#include "webrtc/video_engine/vie_encoder.h"
#include "webrtc/video_engine/vie_impl.h"
#include "webrtc/video_engine/vie_shared_data.h"
namespace webrtc {
@ -97,140 +97,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,
@ -344,340 +210,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),
@ -792,38 +324,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

View File

@ -11,9 +11,9 @@
#ifndef WEBRTC_VIDEO_ENGINE_VIE_NETWORK_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_VIE_NETWORK_IMPL_H_
#include "typedefs.h" // NOLINT
#include "video_engine/include/vie_network.h"
#include "video_engine/vie_ref_count.h"
#include "webrtc/typedefs.h"
#include "webrtc/video_engine/include/vie_network.h"
#include "webrtc/video_engine/vie_ref_count.h"
namespace webrtc {
@ -27,26 +27,6 @@ class ViENetworkImpl
virtual int Release();
virtual void SetNetworkTransmissionState(const int video_channel,
const bool is_transmitting);
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);
@ -56,36 +36,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,
@ -97,11 +47,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);

View File

@ -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_) {

View File

@ -13,12 +13,11 @@
#include <list>
#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"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/typedefs.h"
#include "webrtc/video_engine/vie_defines.h"
namespace webrtc {
@ -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);