diff --git a/webrtc/test/channel_transport/channel_transport.cc b/webrtc/test/channel_transport/channel_transport.cc index 0faeb33b1..546d4a21d 100644 --- a/webrtc/test/channel_transport/channel_transport.cc +++ b/webrtc/test/channel_transport/channel_transport.cc @@ -27,7 +27,7 @@ VoiceChannelTransport::VoiceChannelTransport(VoENetwork* voe_network, int channel) : channel_(channel), voe_network_(voe_network) { - WebRtc_UWord8 socket_threads = 1; + uint8_t socket_threads = 1; socket_transport_ = UdpTransport::Create(channel, socket_threads); #ifndef WEBRTC_ANDROID EXPECT_EQ(0, voe_network_->RegisterExternalTransport(channel, @@ -43,23 +43,23 @@ VoiceChannelTransport::~VoiceChannelTransport() { } void VoiceChannelTransport::IncomingRTPPacket( - const WebRtc_Word8* incoming_rtp_packet, - const WebRtc_Word32 packet_length, + const int8_t* incoming_rtp_packet, + const int32_t packet_length, const char* /*from_ip*/, - const WebRtc_UWord16 /*from_port*/) { + const uint16_t /*from_port*/) { voe_network_->ReceivedRTPPacket(channel_, incoming_rtp_packet, packet_length); } void VoiceChannelTransport::IncomingRTCPPacket( - const WebRtc_Word8* incoming_rtcp_packet, - const WebRtc_Word32 packet_length, + const int8_t* incoming_rtcp_packet, + const int32_t packet_length, const char* /*from_ip*/, - const WebRtc_UWord16 /*from_port*/) { + const uint16_t /*from_port*/) { voe_network_->ReceivedRTCPPacket(channel_, incoming_rtcp_packet, packet_length); } -int VoiceChannelTransport::SetLocalReceiver(WebRtc_UWord16 rtp_port) { +int VoiceChannelTransport::SetLocalReceiver(uint16_t rtp_port) { int return_value = socket_transport_->InitializeReceiveSockets(this, rtp_port); if (return_value == 0) { @@ -69,7 +69,7 @@ int VoiceChannelTransport::SetLocalReceiver(WebRtc_UWord16 rtp_port) { } int VoiceChannelTransport::SetSendDestination(const char* ip_address, - WebRtc_UWord16 rtp_port) { + uint16_t rtp_port) { return socket_transport_->InitializeSendSockets(ip_address, rtp_port); } @@ -78,7 +78,7 @@ VideoChannelTransport::VideoChannelTransport(ViENetwork* vie_network, int channel) : channel_(channel), vie_network_(vie_network) { - WebRtc_UWord8 socket_threads = 1; + uint8_t socket_threads = 1; socket_transport_ = UdpTransport::Create(channel, socket_threads); #ifndef WEBRTC_ANDROID EXPECT_EQ(0, vie_network_->RegisterSendTransport(channel, @@ -94,23 +94,23 @@ VideoChannelTransport::~VideoChannelTransport() { } void VideoChannelTransport::IncomingRTPPacket( - const WebRtc_Word8* incoming_rtp_packet, - const WebRtc_Word32 packet_length, + const int8_t* incoming_rtp_packet, + const int32_t packet_length, const char* /*from_ip*/, - const WebRtc_UWord16 /*from_port*/) { + const uint16_t /*from_port*/) { vie_network_->ReceivedRTPPacket(channel_, incoming_rtp_packet, packet_length); } void VideoChannelTransport::IncomingRTCPPacket( - const WebRtc_Word8* incoming_rtcp_packet, - const WebRtc_Word32 packet_length, + const int8_t* incoming_rtcp_packet, + const int32_t packet_length, const char* /*from_ip*/, - const WebRtc_UWord16 /*from_port*/) { + const uint16_t /*from_port*/) { vie_network_->ReceivedRTCPPacket(channel_, incoming_rtcp_packet, packet_length); } -int VideoChannelTransport::SetLocalReceiver(WebRtc_UWord16 rtp_port) { +int VideoChannelTransport::SetLocalReceiver(uint16_t rtp_port) { int return_value = socket_transport_->InitializeReceiveSockets(this, rtp_port); if (return_value == 0) { @@ -120,7 +120,7 @@ int VideoChannelTransport::SetLocalReceiver(WebRtc_UWord16 rtp_port) { } int VideoChannelTransport::SetSendDestination(const char* ip_address, - WebRtc_UWord16 rtp_port) { + uint16_t rtp_port) { return socket_transport_->InitializeSendSockets(ip_address, rtp_port); } diff --git a/webrtc/test/channel_transport/include/channel_transport.h b/webrtc/test/channel_transport/include/channel_transport.h index ba7182948..5208a5c41 100644 --- a/webrtc/test/channel_transport/include/channel_transport.h +++ b/webrtc/test/channel_transport/include/channel_transport.h @@ -28,22 +28,22 @@ class VoiceChannelTransport : public UdpTransportData { virtual ~VoiceChannelTransport(); // Start implementation of UdpTransportData. - void IncomingRTPPacket(const WebRtc_Word8* incoming_rtp_packet, - const WebRtc_Word32 packet_length, + void IncomingRTPPacket(const int8_t* incoming_rtp_packet, + const int32_t packet_length, const char* /*from_ip*/, - const WebRtc_UWord16 /*from_port*/); + const uint16_t /*from_port*/); - void IncomingRTCPPacket(const WebRtc_Word8* incoming_rtcp_packet, - const WebRtc_Word32 packet_length, + void IncomingRTCPPacket(const int8_t* incoming_rtcp_packet, + const int32_t packet_length, const char* /*from_ip*/, - const WebRtc_UWord16 /*from_port*/); + const uint16_t /*from_port*/); // End implementation of UdpTransportData. // Specifies the ports to receive RTP packets on. - int SetLocalReceiver(WebRtc_UWord16 rtp_port); + int SetLocalReceiver(uint16_t rtp_port); // Specifies the destination port and IP address for a specified channel. - int SetSendDestination(const char* ip_address, WebRtc_UWord16 rtp_port); + int SetSendDestination(const char* ip_address, uint16_t rtp_port); private: int channel_; @@ -59,22 +59,22 @@ class VideoChannelTransport : public UdpTransportData { virtual ~VideoChannelTransport(); // Start implementation of UdpTransportData. - void IncomingRTPPacket(const WebRtc_Word8* incoming_rtp_packet, - const WebRtc_Word32 packet_length, + void IncomingRTPPacket(const int8_t* incoming_rtp_packet, + const int32_t packet_length, const char* /*from_ip*/, - const WebRtc_UWord16 /*from_port*/); + const uint16_t /*from_port*/); - void IncomingRTCPPacket(const WebRtc_Word8* incoming_rtcp_packet, - const WebRtc_Word32 packet_length, + void IncomingRTCPPacket(const int8_t* incoming_rtcp_packet, + const int32_t packet_length, const char* /*from_ip*/, - const WebRtc_UWord16 /*from_port*/); + const uint16_t /*from_port*/); // End implementation of UdpTransportData. // Specifies the ports to receive RTP packets on. - int SetLocalReceiver(WebRtc_UWord16 rtp_port); + int SetLocalReceiver(uint16_t rtp_port); // Specifies the destination port and IP address for a specified channel. - int SetSendDestination(const char* ip_address, WebRtc_UWord16 rtp_port); + int SetSendDestination(const char* ip_address, uint16_t rtp_port); private: int channel_; diff --git a/webrtc/test/channel_transport/traffic_control_win.cc b/webrtc/test/channel_transport/traffic_control_win.cc index 183358625..103412f0b 100644 --- a/webrtc/test/channel_transport/traffic_control_win.cc +++ b/webrtc/test/channel_transport/traffic_control_win.cc @@ -18,14 +18,14 @@ namespace webrtc { namespace test { TrafficControlWindows* TrafficControlWindows::instance = NULL; -WebRtc_UWord32 TrafficControlWindows::refCounter = 0; +uint32_t TrafficControlWindows::refCounter = 0; -TrafficControlWindows::TrafficControlWindows(const WebRtc_Word32 id) : _id(id) +TrafficControlWindows::TrafficControlWindows(const int32_t id) : _id(id) { } TrafficControlWindows* TrafficControlWindows::GetInstance( - const WebRtc_Word32 id) + const int32_t id) { if(instance != NULL) { @@ -165,7 +165,7 @@ void TrafficControlWindows::Release(TrafficControlWindows* gtc) instance = NULL; } } -WebRtc_Word32 TrafficControlWindows::ChangeUniqueId(const WebRtc_Word32 id) +int32_t TrafficControlWindows::ChangeUniqueId(const int32_t id) { _id = id; return 0; diff --git a/webrtc/test/channel_transport/traffic_control_win.h b/webrtc/test/channel_transport/traffic_control_win.h index 7286ed523..63085cf0a 100644 --- a/webrtc/test/channel_transport/traffic_control_win.h +++ b/webrtc/test/channel_transport/traffic_control_win.h @@ -46,10 +46,10 @@ class TrafficControlWindows { public: // Factory method. Constructor disabled. - static TrafficControlWindows* GetInstance(const WebRtc_Word32 id); + static TrafficControlWindows* GetInstance(const int32_t id); static void Release(TrafficControlWindows* gtc); - WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); + int32_t ChangeUniqueId(const int32_t id); ULONG TcRegisterClient(ULONG TciVersion, HANDLE ClRegCtx, PTCI_CLIENT_FUNC_LIST ClientHandlerList, @@ -74,8 +74,8 @@ class TrafficControlWindows ULONG TcDeleteFlow(HANDLE FlowHandle); ULONG TcDeleteFilter(HANDLE FilterHandle); private: - TrafficControlWindows(const WebRtc_Word32 id); - WebRtc_Word32 _id; + TrafficControlWindows(const int32_t id); + int32_t _id; TCI_CLIENT_FUNC_LIST QoSFunctions; static TrafficControlWindows* instance; @@ -93,7 +93,7 @@ private: filterAddFn tcAddFilter; filterDeleteFn tcDeleteFilter; - static WebRtc_UWord32 refCounter; + static uint32_t refCounter; }; } // namespace test diff --git a/webrtc/test/channel_transport/udp_socket2_manager_win.cc b/webrtc/test/channel_transport/udp_socket2_manager_win.cc index 7d490814d..54bd42f20 100644 --- a/webrtc/test/channel_transport/udp_socket2_manager_win.cc +++ b/webrtc/test/channel_transport/udp_socket2_manager_win.cc @@ -19,7 +19,7 @@ namespace webrtc { namespace test { -WebRtc_UWord32 UdpSocket2ManagerWindows::_numOfActiveManagers = 0; +uint32_t UdpSocket2ManagerWindows::_numOfActiveManagers = 0; bool UdpSocket2ManagerWindows::_wsaInit = false; UdpSocket2ManagerWindows::UdpSocket2ManagerWindows() @@ -98,8 +98,8 @@ UdpSocket2ManagerWindows::~UdpSocket2ManagerWindows() } } -bool UdpSocket2ManagerWindows::Init(WebRtc_Word32 id, - WebRtc_UWord8& numOfWorkThreads) { +bool UdpSocket2ManagerWindows::Init(int32_t id, + uint8_t& numOfWorkThreads) { CriticalSectionScoped cs(_pCrit); if ((_id != -1) || (_numOfWorkThreads != 0)) { assert(_id != -1); @@ -111,7 +111,7 @@ bool UdpSocket2ManagerWindows::Init(WebRtc_Word32 id, return true; } -WebRtc_Word32 UdpSocket2ManagerWindows::ChangeUniqueId(const WebRtc_Word32 id) +int32_t UdpSocket2ManagerWindows::ChangeUniqueId(const int32_t id) { _id = id; return 0; @@ -133,7 +133,7 @@ bool UdpSocket2ManagerWindows::Start() _pCrit->Enter(); // Start worker threads. _stopped = false; - WebRtc_Word32 error = 0; + int32_t error = 0; ListItem* pItem = _workerThreadsList.First(); UdpSocket2WorkerWindows* pWorker; while(pItem != NULL && !error) @@ -169,7 +169,7 @@ bool UdpSocket2ManagerWindows::StartWorkerThreads() 0, 0); if(_ioCompletionHandle == NULL) { - WebRtc_Word32 error = GetLastError(); + int32_t error = GetLastError(); WEBRTC_TRACE( kTraceError, kTraceTransport, @@ -182,7 +182,7 @@ bool UdpSocket2ManagerWindows::StartWorkerThreads() } // Create worker threads. - WebRtc_UWord32 i = 0; + uint32_t i = 0; bool error = false; while(i < _numOfWorkThreads && !error) { @@ -272,7 +272,7 @@ bool UdpSocket2ManagerWindows::Stop() bool UdpSocket2ManagerWindows::StopWorkerThreads() { - WebRtc_Word32 error = 0; + int32_t error = 0; WEBRTC_TRACE( kTraceDebug, kTraceTransport, @@ -295,7 +295,7 @@ bool UdpSocket2ManagerWindows::StopWorkerThreads() // Release all threads waiting for GetQueuedCompletionStatus(..). if(_ioCompletionHandle) { - WebRtc_UWord32 i = 0; + uint32_t i = 0; for(i = 0; i < _workerThreadsList.GetSize(); i++) { PostQueuedCompletionStatus(_ioCompletionHandle, 0 ,0 , NULL); @@ -365,7 +365,7 @@ bool UdpSocket2ManagerWindows::AddSocketPrv(UdpSocket2Windows* s) "UdpSocket2ManagerWindows(%d)::AddSocketPrv() socket->GetFd() ==\ %d", _managerNumber, - (WebRtc_Word32)s->GetFd()); + (int32_t)s->GetFd()); _pCrit->Leave(); return false; @@ -375,7 +375,7 @@ bool UdpSocket2ManagerWindows::AddSocketPrv(UdpSocket2Windows* s) (ULONG_PTR)(s), 0); if(_ioCompletionHandle == NULL) { - WebRtc_Word32 error = GetLastError(); + int32_t error = GetLastError(); WEBRTC_TRACE( kTraceError, kTraceTransport, @@ -430,7 +430,7 @@ PerIoContext* UdpSocket2ManagerWindows::PopIoContext() return pIoC; } -WebRtc_Word32 UdpSocket2ManagerWindows::PushIoContext(PerIoContext* pIoContext) +int32_t UdpSocket2ManagerWindows::PushIoContext(PerIoContext* pIoContext) { return _ioContextPool.PushIoContext(pIoContext); } @@ -450,7 +450,7 @@ IoContextPool::~IoContextPool() AlignedFree(_pListHead); } -WebRtc_Word32 IoContextPool::Init(WebRtc_UWord32 /*increaseSize*/) +int32_t IoContextPool::Init(uint32_t /*increaseSize*/) { if(_init) { @@ -495,7 +495,7 @@ PerIoContext* IoContextPool::PopIoContext() return &((IoContextPoolItem*)pListEntry)->payload.ioContext; } -WebRtc_Word32 IoContextPool::PushIoContext(PerIoContext* pIoContext) +int32_t IoContextPool::PushIoContext(PerIoContext* pIoContext) { // TODO (hellner): Overlapped IO should be completed at this point. Perhaps // add an assert? @@ -504,9 +504,9 @@ WebRtc_Word32 IoContextPool::PushIoContext(PerIoContext* pIoContext) IoContextPoolItem* item = ((IoContextPoolItemPayload*)pIoContext)->base; - const WebRtc_Word32 usedItems = --_inUse; - const WebRtc_Word32 totalItems = _size.Value(); - const WebRtc_Word32 freeItems = totalItems - usedItems; + const int32_t usedItems = --_inUse; + const int32_t totalItems = _size.Value(); + const int32_t freeItems = totalItems - usedItems; if(freeItems < 0) { assert(false); @@ -524,14 +524,14 @@ WebRtc_Word32 IoContextPool::PushIoContext(PerIoContext* pIoContext) return 0; } -WebRtc_Word32 IoContextPool::Free() +int32_t IoContextPool::Free() { if(!_init) { return 0; } - WebRtc_Word32 itemsFreed = 0; + int32_t itemsFreed = 0; PSLIST_ENTRY pListEntry = InterlockedPopEntrySList(_pListHead); while(pListEntry != NULL) { @@ -544,7 +544,7 @@ WebRtc_Word32 IoContextPool::Free() return itemsFreed; } -WebRtc_Word32 UdpSocket2WorkerWindows::_numOfWorkers = 0; +int32_t UdpSocket2WorkerWindows::_numOfWorkers = 0; UdpSocket2WorkerWindows::UdpSocket2WorkerWindows(HANDLE ioCompletionHandle) : _ioCompletionHandle(ioCompletionHandle), @@ -588,7 +588,7 @@ void UdpSocket2WorkerWindows::SetNotAlive() _pThread->SetNotAlive(); } -WebRtc_Word32 UdpSocket2WorkerWindows::Init() +int32_t UdpSocket2WorkerWindows::Init() { if(!_init) { @@ -621,7 +621,7 @@ bool UdpSocket2WorkerWindows::Run(ThreadObj obj) // the UdpSocket2ManagerWindows::StopWorkerThreads() function. bool UdpSocket2WorkerWindows::Process() { - WebRtc_Word32 success = 0; + int32_t success = 0; DWORD ioSize = 0; UdpSocket2Windows* pSocket = NULL; PerIoContext* pIOContext = 0; @@ -630,7 +630,7 @@ bool UdpSocket2WorkerWindows::Process() &ioSize, (ULONG_PTR*)&pSocket, &pOverlapped, 200); - WebRtc_UWord32 error = 0; + uint32_t error = 0; if(!success) { error = GetLastError(); diff --git a/webrtc/test/channel_transport/udp_socket2_manager_win.h b/webrtc/test/channel_transport/udp_socket2_manager_win.h index d77c792d3..49b0c1178 100644 --- a/webrtc/test/channel_transport/udp_socket2_manager_win.h +++ b/webrtc/test/channel_transport/udp_socket2_manager_win.h @@ -75,13 +75,13 @@ class IoContextPool public: IoContextPool(); virtual ~IoContextPool(); - virtual WebRtc_Word32 Init(WebRtc_UWord32 increaseSize = 128); + virtual int32_t Init(uint32_t increaseSize = 128); // Re-use an old unused IO context or create a new one. virtual PerIoContext* PopIoContext(); - virtual WebRtc_Word32 PushIoContext(PerIoContext* pIoContext); - virtual inline WebRtc_Word32 GetSize(WebRtc_UWord32* inUse = 0) + virtual int32_t PushIoContext(PerIoContext* pIoContext); + virtual inline int32_t GetSize(uint32_t* inUse = 0) {return _size.Value();} - virtual WebRtc_Word32 Free(); + virtual int32_t Free(); private: // Sample code for use of msfts single linked atomic list can be found here: // http://msdn.microsoft.com/en-us/library/ms686962(VS.85).aspx @@ -101,8 +101,8 @@ public: UdpSocket2ManagerWindows(); virtual ~UdpSocket2ManagerWindows(); - virtual bool Init(WebRtc_Word32 id, WebRtc_UWord8& numOfWorkThreads); - virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); + virtual bool Init(int32_t id, uint8_t& numOfWorkThreads); + virtual int32_t ChangeUniqueId(const int32_t id); virtual bool Start(); virtual bool Stop(); @@ -115,7 +115,7 @@ public: return false;} PerIoContext* PopIoContext(void); - WebRtc_Word32 PushIoContext(PerIoContext* pIoContext); + int32_t PushIoContext(PerIoContext* pIoContext); private: bool StopWorkerThreads(); @@ -123,15 +123,15 @@ private: bool AddSocketPrv(UdpSocket2Windows* s); bool RemoveSocketPrv(UdpSocket2Windows* s); - static WebRtc_UWord32 _numOfActiveManagers; + static uint32_t _numOfActiveManagers; static bool _wsaInit; - WebRtc_Word32 _id; + int32_t _id; CriticalSectionWrapper* _pCrit; - WebRtc_Word32 _managerNumber; + int32_t _managerNumber; volatile bool _stopped; bool _init; - WebRtc_Word32 _numActiveSockets; + int32_t _numActiveSockets; ListWrapper _workerThreadsList; EventWrapper* _event; @@ -147,7 +147,7 @@ public: virtual bool Start(); virtual bool Stop(); - virtual WebRtc_Word32 Init(); + virtual int32_t Init(); virtual void SetNotAlive(); protected: static bool Run(ThreadObj obj); @@ -155,8 +155,8 @@ protected: private: HANDLE _ioCompletionHandle; ThreadWrapper*_pThread; - static WebRtc_Word32 _numOfWorkers; - WebRtc_Word32 _workerNumber; + static int32_t _numOfWorkers; + int32_t _workerNumber; volatile bool _stop; bool _init; }; diff --git a/webrtc/test/channel_transport/udp_socket2_win.cc b/webrtc/test/channel_transport/udp_socket2_win.cc index fe26273e0..b244f7224 100644 --- a/webrtc/test/channel_transport/udp_socket2_win.cc +++ b/webrtc/test/channel_transport/udp_socket2_win.cc @@ -39,7 +39,7 @@ typedef const QOS_DESTADDR* LPCQOS_DESTADDR; #define QOS_GENERAL_ID_BASE 2000 #define QOS_OBJECT_DESTADDR (0x00000004 + QOS_GENERAL_ID_BASE) -UdpSocket2Windows::UdpSocket2Windows(const WebRtc_Word32 id, +UdpSocket2Windows::UdpSocket2Windows(const int32_t id, UdpSocketManager* mgr, bool ipV6Enable, bool disableGQOS) : _id(id), @@ -85,7 +85,7 @@ UdpSocket2Windows::UdpSocket2Windows(const WebRtc_Word32 id, DWORD dwBufLen = 0; // Set dwBufLen to the size needed to retreive all the requested // information from WSAEnumProtocols. - WebRtc_Word32 nRet = WSAEnumProtocols(NULL, lpProtocolBuf, &dwBufLen); + int32_t nRet = WSAEnumProtocols(NULL, lpProtocolBuf, &dwBufLen); lpProtocolBuf = (WSAPROTOCOL_INFO*)malloc(dwBufLen); nRet = WSAEnumProtocols(NULL, lpProtocolBuf, &dwBufLen); @@ -96,7 +96,7 @@ UdpSocket2Windows::UdpSocket2Windows(const WebRtc_Word32 id, _iProtocol=AF_INET; } - for (WebRtc_Word32 i=0; iReleaseLockExclusive(); WEBRTC_TRACE(kTraceDebug, kTraceTransport, _id, - "UdpSocket2Windows(%d)::SetCallback ",(WebRtc_Word32)this); + "UdpSocket2Windows(%d)::SetCallback ",(int32_t)this); if(_addedToMgr) { WEBRTC_TRACE(kTraceDebug, kTraceTransport, _id, "UdpSocket2Windows(%d)::SetCallback alreadey added", - (WebRtc_Word32) this); + (int32_t) this); return false; } @@ -252,20 +252,19 @@ bool UdpSocket2Windows::SetCallback(CallbackObj obj, IncomingSocketCallback cb) WEBRTC_TRACE( kTraceDebug, kTraceTransport, _id, "UdpSocket2Windows(%d)::SetCallback socket added to manager", - (WebRtc_Word32)this); + (int32_t)this); _addedToMgr = true; return true; } WEBRTC_TRACE(kTraceDebug, kTraceTransport, _id, "UdpSocket2Windows(%d)::SetCallback error adding me to mgr", - (WebRtc_Word32) this); + (int32_t) this); return false; } -bool UdpSocket2Windows::SetSockopt(WebRtc_Word32 level, WebRtc_Word32 optname, - const WebRtc_Word8* optval, - WebRtc_Word32 optlen) +bool UdpSocket2Windows::SetSockopt(int32_t level, int32_t optname, + const int8_t* optval, int32_t optlen) { bool returnValue = true; if(!AquireSocket()) @@ -284,21 +283,21 @@ bool UdpSocket2Windows::SetSockopt(WebRtc_Word32 level, WebRtc_Word32 optname, return returnValue; } -bool UdpSocket2Windows::StartReceiving(WebRtc_UWord32 receiveBuffers) +bool UdpSocket2Windows::StartReceiving(uint32_t receiveBuffers) { WEBRTC_TRACE(kTraceDebug, kTraceTransport, _id, - "UdpSocket2Windows(%d)::StartReceiving(%d)", - (WebRtc_Word32)this, receiveBuffers); + "UdpSocket2Windows(%d)::StartReceiving(%d)", (int32_t)this, + receiveBuffers); _wantsIncoming = true; - WebRtc_Word32 numberOfReceiveBuffersToCreate = + int32_t numberOfReceiveBuffersToCreate = receiveBuffers - _receiveBuffers.Value(); numberOfReceiveBuffersToCreate = (numberOfReceiveBuffersToCreate < 0) ? 0 : numberOfReceiveBuffersToCreate; - WebRtc_Word32 error = 0; - for(WebRtc_Word32 i = 0; + int32_t error = 0; + for(int32_t i = 0; i < numberOfReceiveBuffersToCreate; i++) { @@ -350,17 +349,16 @@ bool UdpSocket2Windows::Bind(const SocketAddress& name) return returnValue; } -WebRtc_Word32 UdpSocket2Windows::SendTo(const WebRtc_Word8* buf, - WebRtc_Word32 len, - const SocketAddress& to) +int32_t UdpSocket2Windows::SendTo(const int8_t* buf, int32_t len, + const SocketAddress& to) { - WebRtc_Word32 retVal = 0; - WebRtc_Word32 error = 0; + int32_t retVal = 0; + int32_t error = 0; if(len < 0) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "UdpSocket2Windows(%d)::SendTo(), len= %d < 0", - (WebRtc_Word32)this, len); + (int32_t)this, len); return -1; } @@ -369,19 +367,19 @@ WebRtc_Word32 UdpSocket2Windows::SendTo(const WebRtc_Word8* buf, { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "UdpSocket2Windows(%d)::SendTo(), pIoContext==0", - (WebRtc_Word32) this); + (int32_t) this); return -1; } // sizeof(pIoContext->buffer) is smaller than the highest number that - // can be represented by a WebRtc_Word32. - if(len >= (WebRtc_Word32) sizeof(pIoContext->buffer)) + // can be represented by a int32_t. + if(len >= (int32_t) sizeof(pIoContext->buffer)) { WEBRTC_TRACE( kTraceError, kTraceTransport, _id, "UdpSocket2Windows(%d)::SendTo(), len= %d > buffer_size = %d", - (WebRtc_Word32) this, + (int32_t) this, len,sizeof(pIoContext->buffer)); len = sizeof(pIoContext->buffer); } @@ -435,7 +433,7 @@ WebRtc_Word32 UdpSocket2Windows::SendTo(const WebRtc_Word8* buf, kTraceTransport, _id, "UdpSocket2Windows(%d)::SendTo(), error:%d pushing ioContext", - (WebRtc_Word32)this, error); + (int32_t)this, error); } // Roll back. @@ -444,7 +442,7 @@ WebRtc_Word32 UdpSocket2Windows::SendTo(const WebRtc_Word8* buf, } void UdpSocket2Windows::IOCompleted(PerIoContext* pIOContext, - WebRtc_UWord32 ioSize, WebRtc_UWord32 error) + uint32_t ioSize, uint32_t error) { if(pIOContext == NULL || error == ERROR_OPERATION_ABORTED) { @@ -477,10 +475,10 @@ void UdpSocket2Windows::IOCompleted(PerIoContext* pIOContext, kTraceTransport, _id, "UdpSocket2Windows::IOCompleted(%d,%d,%d), %d", - (WebRtc_Word32)pIOContext, + (int32_t)pIOContext, ioSize, error, - pIOContext ? (WebRtc_Word32)pIOContext->ioOperation : -1); + pIOContext ? (int32_t)pIOContext->ioOperation : -1); } else { WEBRTC_TRACE( kTraceDebug, @@ -490,12 +488,12 @@ void UdpSocket2Windows::IOCompleted(PerIoContext* pIOContext, } if(pIOContext) { - WebRtc_Word32 remainingReceiveBuffers = --_receiveBuffers; + int32_t remainingReceiveBuffers = --_receiveBuffers; if(remainingReceiveBuffers < 0) { assert(false); } - WebRtc_Word32 err = 0; + int32_t err = 0; if((err = _mgr->PushIoContext(pIOContext))) { WEBRTC_TRACE( @@ -524,14 +522,14 @@ void UdpSocket2Windows::IOCompleted(PerIoContext* pIOContext, if(_wantsIncoming && _incomingCb) { _incomingCb(_obj, - reinterpret_cast( + reinterpret_cast( pIOContext->wsabuf.buf), ioSize, &pIOContext->from); } _ptrCbRWLock->ReleaseLockShared(); } - WebRtc_Word32 err = PostRecv(pIOContext); + int32_t err = PostRecv(pIOContext); if(err == 0) { // The PerIoContext was posted by a thread controlled by the socket @@ -551,14 +549,14 @@ void UdpSocket2Windows::IOCompleted(PerIoContext* pIOContext, // may be deleted at this point. } -WebRtc_Word32 UdpSocket2Windows::PostRecv() +int32_t UdpSocket2Windows::PostRecv() { PerIoContext* pIoContext=_mgr->PopIoContext(); if(pIoContext == 0) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "UdpSocket2Windows(%d)::PostRecv(), pIoContext == 0", - (WebRtc_Word32)this); + (int32_t)this); return -1; } // This function may have been called by thread not controlled by the socket @@ -567,13 +565,13 @@ WebRtc_Word32 UdpSocket2Windows::PostRecv() return PostRecv(pIoContext); } -WebRtc_Word32 UdpSocket2Windows::PostRecv(PerIoContext* pIoContext) +int32_t UdpSocket2Windows::PostRecv(PerIoContext* pIoContext) { if(pIoContext==0) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "UdpSocket2Windows(%d)::PostRecv(?), pIoContext==0", - (WebRtc_Word32)this); + (int32_t)this); return -1; } @@ -583,9 +581,9 @@ WebRtc_Word32 UdpSocket2Windows::PostRecv(PerIoContext* pIoContext) pIoContext->wsabuf.len = sizeof(pIoContext->buffer); pIoContext->fromLen = sizeof(SocketAddress); pIoContext->ioOperation = OP_READ; - WebRtc_Word32 rxError = 0; - WebRtc_Word32 nRet = 0; - WebRtc_Word32 postingSucessfull = false; + int32_t rxError = 0; + int32_t nRet = 0; + int32_t postingSucessfull = false; if(!AquireSocket()) { @@ -601,7 +599,7 @@ WebRtc_Word32 UdpSocket2Windows::PostRecv(PerIoContext* pIoContext) ReleaseSocket(); return -1; } - for(WebRtc_Word32 tries = 0; tries < 10; tries++) + for(int32_t tries = 0; tries < 10; tries++) { nRet = WSARecvFrom( _socket, @@ -625,7 +623,7 @@ WebRtc_Word32 UdpSocket2Windows::PostRecv(PerIoContext* pIoContext) _id, "UdpSocket2Windows(%d)::PostRecv(?), WSAerror:%d when\ posting new recieve,trie:%d", - (WebRtc_Word32)this, + (int32_t)this, rxError, tries); // Tell the OS that this is a good place to context switch if @@ -645,12 +643,12 @@ WebRtc_Word32 UdpSocket2Windows::PostRecv(PerIoContext* pIoContext) { return 0; } - WebRtc_Word32 remainingReceiveBuffers = --_receiveBuffers; + int32_t remainingReceiveBuffers = --_receiveBuffers; if(remainingReceiveBuffers < 0) { assert(false); } - WebRtc_Word32 error = 0; + int32_t error = 0; if((error = _mgr->PushIoContext(pIoContext))) { WEBRTC_TRACE( @@ -658,7 +656,7 @@ WebRtc_Word32 UdpSocket2Windows::PostRecv(PerIoContext* pIoContext) kTraceTransport, _id, "UdpSocket2Windows(%d)::PostRecv(?), error:%d when PushIoContext", - (WebRtc_Word32)this, + (int32_t)this, error); } // Roll back. @@ -688,14 +686,14 @@ void UdpSocket2Windows::CloseBlocking() delete this; } -bool UdpSocket2Windows::SetQos(WebRtc_Word32 serviceType, - WebRtc_Word32 tokenRate, - WebRtc_Word32 bucketSize, - WebRtc_Word32 peekBandwith, - WebRtc_Word32 minPolicedSize, - WebRtc_Word32 maxSduSize, +bool UdpSocket2Windows::SetQos(int32_t serviceType, + int32_t tokenRate, + int32_t bucketSize, + int32_t peekBandwith, + int32_t minPolicedSize, + int32_t maxSduSize, const SocketAddress &stRemName, - WebRtc_Word32 overrideDSCP) + int32_t overrideDSCP) { if(_qos == false) { @@ -706,9 +704,9 @@ bool UdpSocket2Windows::SetQos(WebRtc_Word32 serviceType, if(overrideDSCP != 0) { FLOWSPEC f; - WebRtc_Word32 err = CreateFlowSpec(serviceType, tokenRate, bucketSize, - peekBandwith, minPolicedSize, - maxSduSize, &f); + int32_t err = CreateFlowSpec(serviceType, tokenRate, bucketSize, + peekBandwith, minPolicedSize, + maxSduSize, &f); if(err == -1) { return false; @@ -761,7 +759,7 @@ bool UdpSocket2Windows::SetQos(WebRtc_Word32 serviceType, Qos.ProviderSpecific.buf = NULL; - ZeroMemory((WebRtc_Word8 *)&QosDestaddr, sizeof(QosDestaddr)); + ZeroMemory((int8_t *)&QosDestaddr, sizeof(QosDestaddr)); OSVERSIONINFOEX osvie; osvie.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); @@ -809,7 +807,7 @@ bool UdpSocket2Windows::SetQos(WebRtc_Word32 serviceType, } // To set QoS with SIO_SET_QOS the socket must be locally bound first // or the call will fail with error code 10022. - WebRtc_Word32 result = WSAIoctl(GetFd(), SIO_SET_QOS, &Qos, sizeof(QOS), + int32_t result = WSAIoctl(GetFd(), SIO_SET_QOS, &Qos, sizeof(QOS), NULL, 0, &BytesRet, NULL,NULL); ReleaseSocket(); if (result == SOCKET_ERROR) @@ -822,7 +820,7 @@ bool UdpSocket2Windows::SetQos(WebRtc_Word32 serviceType, return true; } -WebRtc_Word32 UdpSocket2Windows::SetTOS(WebRtc_Word32 serviceType) +int32_t UdpSocket2Windows::SetTOS(int32_t serviceType) { SocketAddress socketName; @@ -835,7 +833,7 @@ WebRtc_Word32 UdpSocket2Windows::SetTOS(WebRtc_Word32 serviceType) ReleaseSocket(); } - WebRtc_Word32 res = SetTrafficControl(serviceType, -1, name); + int32_t res = SetTrafficControl(serviceType, -1, name); if (res == -1) { OSVERSIONINFO OsVersion; @@ -845,7 +843,7 @@ WebRtc_Word32 UdpSocket2Windows::SetTOS(WebRtc_Word32 serviceType) if ((OsVersion.dwMajorVersion == 4)) // NT 4.0 { if(SetSockopt(IPPROTO_IP,IP_TOS , - (WebRtc_Word8*)&serviceType, 4) != 0) + (int8_t*)&serviceType, 4) != 0) { return -1; } @@ -854,7 +852,7 @@ WebRtc_Word32 UdpSocket2Windows::SetTOS(WebRtc_Word32 serviceType) return res; } -WebRtc_Word32 UdpSocket2Windows::SetPCP(WebRtc_Word32 pcp) +int32_t UdpSocket2Windows::SetPCP(int32_t pcp) { SocketAddress socketName; struct sockaddr_in* name = @@ -868,9 +866,9 @@ WebRtc_Word32 UdpSocket2Windows::SetPCP(WebRtc_Word32 pcp) return SetTrafficControl(-1, pcp, name); } -WebRtc_Word32 UdpSocket2Windows::SetTrafficControl( - WebRtc_Word32 dscp, - WebRtc_Word32 pcp, +int32_t UdpSocket2Windows::SetTrafficControl( + int32_t dscp, + int32_t pcp, const struct sockaddr_in* name, FLOWSPEC* send, FLOWSPEC* recv) { @@ -988,9 +986,9 @@ WebRtc_Word32 UdpSocket2Windows::SetTrafficControl( // Find the interface corresponding to the local address. for(oneinterface = pInterfaceBuffer; oneinterface != (PTC_IFC_DESCRIPTOR) - (((WebRtc_Word8*)pInterfaceBuffer) + BufferSize); + (((int8_t*)pInterfaceBuffer) + BufferSize); oneinterface = (PTC_IFC_DESCRIPTOR) - ((WebRtc_Word8 *)oneinterface + oneinterface->Length)) + ((int8_t *)oneinterface + oneinterface->Length)) { char interfaceName[500]; @@ -1201,8 +1199,8 @@ WebRtc_Word32 UdpSocket2Windows::SetTrafficControl( IP_PATTERN filterPattern, mask; - ZeroMemory((WebRtc_Word8*)&filterPattern, sizeof(IP_PATTERN)); - ZeroMemory((WebRtc_Word8*)&mask, sizeof(IP_PATTERN)); + ZeroMemory((int8_t*)&filterPattern, sizeof(IP_PATTERN)); + ZeroMemory((int8_t*)&mask, sizeof(IP_PATTERN)); filterPattern.ProtocolId = IPPROTO_UDP; // "name" fields already in network order. @@ -1247,13 +1245,13 @@ WebRtc_Word32 UdpSocket2Windows::SetTrafficControl( return 0; } -WebRtc_Word32 UdpSocket2Windows::CreateFlowSpec(WebRtc_Word32 serviceType, - WebRtc_Word32 tokenRate, - WebRtc_Word32 bucketSize, - WebRtc_Word32 peekBandwith, - WebRtc_Word32 minPolicedSize, - WebRtc_Word32 maxSduSize, - FLOWSPEC* f) +int32_t UdpSocket2Windows::CreateFlowSpec(int32_t serviceType, + int32_t tokenRate, + int32_t bucketSize, + int32_t peekBandwith, + int32_t minPolicedSize, + int32_t maxSduSize, + FLOWSPEC* f) { if (!f) { @@ -1380,7 +1378,7 @@ bool UdpSocket2Windows::InvalidateSocket() { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "UdpSocket2Windows(%d)::InvalidateSocket() WSAerror: %d", - (WebRtc_Word32)this, WSAGetLastError()); + (int32_t)this, WSAGetLastError()); } _socket = INVALID_SOCKET; _ptrSocketRWLock->ReleaseLockExclusive(); diff --git a/webrtc/test/channel_transport/udp_socket2_win.h b/webrtc/test/channel_transport/udp_socket2_win.h index 624db9b3b..b9c4f973a 100644 --- a/webrtc/test/channel_transport/udp_socket2_win.h +++ b/webrtc/test/channel_transport/udp_socket2_win.h @@ -39,48 +39,47 @@ struct PerIoContext; class UdpSocket2Windows : public UdpSocketWrapper { public: - UdpSocket2Windows(const WebRtc_Word32 id, UdpSocketManager* mgr, + UdpSocket2Windows(const int32_t id, UdpSocketManager* mgr, bool ipV6Enable = false, bool disableGQOS = false); virtual ~UdpSocket2Windows(); - virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); + virtual int32_t ChangeUniqueId(const int32_t id); virtual bool ValidHandle(); virtual bool SetCallback(CallbackObj, IncomingSocketCallback); virtual bool Bind(const SocketAddress& name); - virtual bool SetSockopt(WebRtc_Word32 level, WebRtc_Word32 optname, - const WebRtc_Word8* optval, WebRtc_Word32 optlen); + virtual bool SetSockopt(int32_t level, int32_t optname, + const int8_t* optval, int32_t optlen); - virtual bool StartReceiving(const WebRtc_UWord32 receiveBuffers); + virtual bool StartReceiving(const uint32_t receiveBuffers); virtual inline bool StartReceiving() {return StartReceiving(8);} virtual bool StopReceiving(); - virtual WebRtc_Word32 SendTo(const WebRtc_Word8* buf, WebRtc_Word32 len, - const SocketAddress& to); + virtual int32_t SendTo(const int8_t* buf, int32_t len, + const SocketAddress& to); virtual void CloseBlocking(); virtual SOCKET GetFd() { return _socket;} - virtual bool SetQos(WebRtc_Word32 serviceType, WebRtc_Word32 tokenRate, - WebRtc_Word32 bucketSize, WebRtc_Word32 peekBandwith, - WebRtc_Word32 minPolicedSize, WebRtc_Word32 maxSduSize, + virtual bool SetQos(int32_t serviceType, int32_t tokenRate, + int32_t bucketSize, int32_t peekBandwith, + int32_t minPolicedSize, int32_t maxSduSize, const SocketAddress &stRemName, - WebRtc_Word32 overrideDSCP = 0); + int32_t overrideDSCP = 0); - virtual WebRtc_Word32 SetTOS(const WebRtc_Word32 serviceType); - virtual WebRtc_Word32 SetPCP(const WebRtc_Word32 pcp); + virtual int32_t SetTOS(const int32_t serviceType); + virtual int32_t SetPCP(const int32_t pcp); - virtual WebRtc_UWord32 ReceiveBuffers(){return _receiveBuffers.Value();} + virtual uint32_t ReceiveBuffers(){return _receiveBuffers.Value();} protected: - void IOCompleted(PerIoContext* pIOContext, WebRtc_UWord32 ioSize, - WebRtc_UWord32 error); + void IOCompleted(PerIoContext* pIOContext, uint32_t ioSize, uint32_t error); - WebRtc_Word32 PostRecv(); + int32_t PostRecv(); // Use pIoContext to post a new WSARecvFrom(..). - WebRtc_Word32 PostRecv(PerIoContext* pIoContext); + int32_t PostRecv(PerIoContext* pIoContext); private: friend class UdpSocket2WorkerWindows; @@ -108,18 +107,18 @@ private: // If dscp is 0 and pcp is 0-7 (1), (2) and (3) will be created. // Note: input parameter values are assumed to be in valid range, checks // must be done by caller. - WebRtc_Word32 SetTrafficControl(WebRtc_Word32 dscp, WebRtc_Word32 pcp, - const struct sockaddr_in* name, - FLOWSPEC* send = NULL, - FLOWSPEC* recv = NULL); - WebRtc_Word32 CreateFlowSpec(WebRtc_Word32 serviceType, - WebRtc_Word32 tokenRate, - WebRtc_Word32 bucketSize, - WebRtc_Word32 peekBandwith, - WebRtc_Word32 minPolicedSize, - WebRtc_Word32 maxSduSize, FLOWSPEC *f); + int32_t SetTrafficControl(int32_t dscp, int32_t pcp, + const struct sockaddr_in* name, + FLOWSPEC* send = NULL, + FLOWSPEC* recv = NULL); + int32_t CreateFlowSpec(int32_t serviceType, + int32_t tokenRate, + int32_t bucketSize, + int32_t peekBandwith, + int32_t minPolicedSize, + int32_t maxSduSize, FLOWSPEC *f); - WebRtc_Word32 _id; + int32_t _id; RWLockWrapper* _ptrCbRWLock; IncomingSocketCallback _incomingCb; CallbackObj _obj; @@ -127,7 +126,7 @@ private: SocketAddress _remoteAddr; SOCKET _socket; - WebRtc_Word32 _iProtocol; + int32_t _iProtocol; UdpSocket2ManagerWindows* _mgr; CriticalSectionWrapper* _pCrit; diff --git a/webrtc/test/channel_transport/udp_socket_manager_posix.cc b/webrtc/test/channel_transport/udp_socket_manager_posix.cc index 8cd270f42..ac30c642d 100644 --- a/webrtc/test/channel_transport/udp_socket_manager_posix.cc +++ b/webrtc/test/channel_transport/udp_socket_manager_posix.cc @@ -35,8 +35,7 @@ UdpSocketManagerPosix::UdpSocketManagerPosix() { } -bool UdpSocketManagerPosix::Init(WebRtc_Word32 id, - WebRtc_UWord8& numOfWorkThreads) { +bool UdpSocketManagerPosix::Init(int32_t id, uint8_t& numOfWorkThreads) { CriticalSectionScoped cs(_critSect); if ((_id != -1) || (_numOfWorkThreads != 0)) { assert(_id != -1); @@ -74,7 +73,7 @@ UdpSocketManagerPosix::~UdpSocketManagerPosix() delete _critSect; } -WebRtc_Word32 UdpSocketManagerPosix::ChangeUniqueId(const WebRtc_Word32 id) +int32_t UdpSocketManagerPosix::ChangeUniqueId(const int32_t id) { _id = id; return 0; diff --git a/webrtc/test/channel_transport/udp_socket_manager_posix.h b/webrtc/test/channel_transport/udp_socket_manager_posix.h index e6df98e30..264c4a253 100644 --- a/webrtc/test/channel_transport/udp_socket_manager_posix.h +++ b/webrtc/test/channel_transport/udp_socket_manager_posix.h @@ -36,10 +36,9 @@ public: UdpSocketManagerPosix(); virtual ~UdpSocketManagerPosix(); - virtual bool Init(WebRtc_Word32 id, - WebRtc_UWord8& numOfWorkThreads); + virtual bool Init(int32_t id, uint8_t& numOfWorkThreads); - virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); + virtual int32_t ChangeUniqueId(const int32_t id); virtual bool Start(); virtual bool Stop(); @@ -47,11 +46,11 @@ public: virtual bool AddSocket(UdpSocketWrapper* s); virtual bool RemoveSocket(UdpSocketWrapper* s); private: - WebRtc_Word32 _id; + int32_t _id; CriticalSectionWrapper* _critSect; - WebRtc_UWord8 _numberOfSocketMgr; - WebRtc_UWord8 _incSocketMgrNextTime; - WebRtc_UWord8 _nextSocketMgrToAssign; + uint8_t _numberOfSocketMgr; + uint8_t _incSocketMgrNextTime; + uint8_t _nextSocketMgrToAssign; UdpSocketManagerPosixImpl* _socketMgr[MAX_NUMBER_OF_SOCKET_MANAGERS_LINUX]; }; diff --git a/webrtc/test/channel_transport/udp_socket_manager_unittest.cc b/webrtc/test/channel_transport/udp_socket_manager_unittest.cc index 8045dfe4c..c1a29a8d7 100644 --- a/webrtc/test/channel_transport/udp_socket_manager_unittest.cc +++ b/webrtc/test/channel_transport/udp_socket_manager_unittest.cc @@ -24,8 +24,8 @@ namespace webrtc { namespace test { TEST(UdpSocketManager, CreateCallsInitAndDoesNotLeakMemory) { - WebRtc_Word32 id = 42; - WebRtc_UWord8 threads = 1; + int32_t id = 42; + uint8_t threads = 1; UdpSocketManager* mgr = UdpSocketManager::Create(id, threads); // Create is supposed to have called init on the object. EXPECT_FALSE(mgr->Init(id, threads)) @@ -36,8 +36,8 @@ TEST(UdpSocketManager, CreateCallsInitAndDoesNotLeakMemory) { // Creates a socket and adds it to the socket manager, and then removes it // before destroying the socket manager. TEST(UdpSocketManager, AddAndRemoveSocketDoesNotLeakMemory) { - WebRtc_Word32 id = 42; - WebRtc_UWord8 threads = 1; + int32_t id = 42; + uint8_t threads = 1; UdpSocketManager* mgr = UdpSocketManager::Create(id, threads); UdpSocketWrapper* socket = UdpSocketWrapper::CreateSocket(id, @@ -61,8 +61,8 @@ TEST(UdpSocketManager, UnremovedSocketsGetCollectedAtManagerDeletion) { #if defined(_WIN32) // It's hard to test an infinite wait, so we don't. #else - WebRtc_Word32 id = 42; - WebRtc_UWord8 threads = 1; + int32_t id = 42; + uint8_t threads = 1; UdpSocketManager* mgr = UdpSocketManager::Create(id, threads); UdpSocketWrapper* unused_socket = UdpSocketWrapper::CreateSocket( id, diff --git a/webrtc/test/channel_transport/udp_socket_manager_wrapper.cc b/webrtc/test/channel_transport/udp_socket_manager_wrapper.cc index e26e649a2..2a4397741 100644 --- a/webrtc/test/channel_transport/udp_socket_manager_wrapper.cc +++ b/webrtc/test/channel_transport/udp_socket_manager_wrapper.cc @@ -33,8 +33,8 @@ UdpSocketManager* UdpSocketManager::CreateInstance() UdpSocketManager* UdpSocketManager::StaticInstance( CountOperation count_operation, - const WebRtc_Word32 id, - WebRtc_UWord8& numOfWorkThreads) + const int32_t id, + uint8_t& numOfWorkThreads) { UdpSocketManager* impl = GetStaticInstance(count_operation); @@ -46,15 +46,15 @@ UdpSocketManager* UdpSocketManager::StaticInstance( return impl; } -UdpSocketManager* UdpSocketManager::Create(const WebRtc_Word32 id, - WebRtc_UWord8& numOfWorkThreads) +UdpSocketManager* UdpSocketManager::Create(const int32_t id, + uint8_t& numOfWorkThreads) { return UdpSocketManager::StaticInstance(kAddRef, id, numOfWorkThreads); } void UdpSocketManager::Return() { - WebRtc_UWord8 numOfWorkThreads = 0; + uint8_t numOfWorkThreads = 0; UdpSocketManager::StaticInstance(kRelease, -1, numOfWorkThreads); } @@ -63,7 +63,7 @@ UdpSocketManager::UdpSocketManager() : _numOfWorkThreads(0) { } -WebRtc_UWord8 UdpSocketManager::WorkThreads() const +uint8_t UdpSocketManager::WorkThreads() const { return _numOfWorkThreads; } diff --git a/webrtc/test/channel_transport/udp_socket_manager_wrapper.h b/webrtc/test/channel_transport/udp_socket_manager_wrapper.h index 2cad1cbb9..5d5572be1 100644 --- a/webrtc/test/channel_transport/udp_socket_manager_wrapper.h +++ b/webrtc/test/channel_transport/udp_socket_manager_wrapper.h @@ -22,16 +22,15 @@ class UdpSocketWrapper; class UdpSocketManager { public: - static UdpSocketManager* Create(const WebRtc_Word32 id, - WebRtc_UWord8& numOfWorkThreads); + static UdpSocketManager* Create(const int32_t id, + uint8_t& numOfWorkThreads); static void Return(); // Initializes the socket manager. Returns true if the manager wasn't // already initialized. - virtual bool Init(WebRtc_Word32 id, - WebRtc_UWord8& numOfWorkThreads) = 0; + virtual bool Init(int32_t id, uint8_t& numOfWorkThreads) = 0; - virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id) = 0; + virtual int32_t ChangeUniqueId(const int32_t id) = 0; // Start listening to sockets that have been registered via the // AddSocket(..) API. @@ -39,7 +38,7 @@ public: // Stop listening to sockets. virtual bool Stop() = 0; - virtual WebRtc_UWord8 WorkThreads() const; + virtual uint8_t WorkThreads() const; // Register a socket with the socket manager. virtual bool AddSocket(UdpSocketWrapper* s) = 0; @@ -50,7 +49,7 @@ protected: UdpSocketManager(); virtual ~UdpSocketManager() {} - WebRtc_UWord8 _numOfWorkThreads; + uint8_t _numOfWorkThreads; // Factory method. static UdpSocketManager* CreateInstance(); @@ -63,8 +62,8 @@ private: static UdpSocketManager* StaticInstance( CountOperation count_operation, - const WebRtc_Word32 id, - WebRtc_UWord8& numOfWorkThreads); + const int32_t id, + uint8_t& numOfWorkThreads); }; } // namespace test diff --git a/webrtc/test/channel_transport/udp_socket_posix.cc b/webrtc/test/channel_transport/udp_socket_posix.cc index 016526c3b..eaf36fc0b 100644 --- a/webrtc/test/channel_transport/udp_socket_posix.cc +++ b/webrtc/test/channel_transport/udp_socket_posix.cc @@ -26,7 +26,7 @@ namespace webrtc { namespace test { -UdpSocketPosix::UdpSocketPosix(const WebRtc_Word32 id, UdpSocketManager* mgr, +UdpSocketPosix::UdpSocketPosix(const int32_t id, UdpSocketManager* mgr, bool ipV6Enable) { WEBRTC_TRACE(kTraceMemory, kTraceTransport, id, @@ -93,7 +93,7 @@ UdpSocketPosix::~UdpSocketPosix() } } -WebRtc_Word32 UdpSocketPosix::ChangeUniqueId(const WebRtc_Word32 id) +int32_t UdpSocketPosix::ChangeUniqueId(const int32_t id) { _id = id; return 0; @@ -121,8 +121,8 @@ bool UdpSocketPosix::SetCallback(CallbackObj obj, IncomingSocketCallback cb) return false; } -bool UdpSocketPosix::SetSockopt(WebRtc_Word32 level, WebRtc_Word32 optname, - const WebRtc_Word8* optval, WebRtc_Word32 optlen) +bool UdpSocketPosix::SetSockopt(int32_t level, int32_t optname, + const int8_t* optval, int32_t optlen) { if(0 == setsockopt(_socket, level, optname, optval, optlen )) { @@ -135,9 +135,9 @@ bool UdpSocketPosix::SetSockopt(WebRtc_Word32 level, WebRtc_Word32 optname, return false; } -WebRtc_Word32 UdpSocketPosix::SetTOS(WebRtc_Word32 serviceType) +int32_t UdpSocketPosix::SetTOS(int32_t serviceType) { - if (SetSockopt(IPPROTO_IP, IP_TOS ,(WebRtc_Word8*)&serviceType ,4) != 0) + if (SetSockopt(IPPROTO_IP, IP_TOS ,(int8_t*)&serviceType ,4) != 0) { return -1; } @@ -157,8 +157,8 @@ bool UdpSocketPosix::Bind(const SocketAddress& name) return false; } -WebRtc_Word32 UdpSocketPosix::SendTo(const WebRtc_Word8* buf, WebRtc_Word32 len, - const SocketAddress& to) +int32_t UdpSocketPosix::SendTo(const int8_t* buf, int32_t len, + const SocketAddress& to) { int size = sizeof(sockaddr); int retVal = sendto(_socket,buf, len, 0, @@ -182,7 +182,7 @@ void UdpSocketPosix::HasIncoming() { // replace 2048 with a mcro define and figure out // where 2048 comes from - WebRtc_Word8 buf[2048]; + int8_t buf[2048]; int retval; SocketAddress from; #if defined(WEBRTC_MAC) diff --git a/webrtc/test/channel_transport/udp_socket_posix.h b/webrtc/test/channel_transport/udp_socket_posix.h index b77d66322..68e0f8ee8 100644 --- a/webrtc/test/channel_transport/udp_socket_posix.h +++ b/webrtc/test/channel_transport/udp_socket_posix.h @@ -28,42 +28,42 @@ namespace test { class UdpSocketPosix : public UdpSocketWrapper { public: - UdpSocketPosix(const WebRtc_Word32 id, UdpSocketManager* mgr, + UdpSocketPosix(const int32_t id, UdpSocketManager* mgr, bool ipV6Enable = false); virtual ~UdpSocketPosix(); - virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); + virtual int32_t ChangeUniqueId(const int32_t id); virtual bool SetCallback(CallbackObj obj, IncomingSocketCallback cb); virtual bool Bind(const SocketAddress& name); - virtual bool SetSockopt(WebRtc_Word32 level, WebRtc_Word32 optname, - const WebRtc_Word8* optval, WebRtc_Word32 optlen); + virtual bool SetSockopt(int32_t level, int32_t optname, + const int8_t* optval, int32_t optlen); - virtual WebRtc_Word32 SetTOS(const WebRtc_Word32 serviceType); + virtual int32_t SetTOS(const int32_t serviceType); - virtual WebRtc_Word32 SendTo(const WebRtc_Word8* buf, WebRtc_Word32 len, - const SocketAddress& to); + virtual int32_t SendTo(const int8_t* buf, int32_t len, + const SocketAddress& to); // Deletes socket in addition to closing it. // TODO (hellner): make destructor protected. virtual void CloseBlocking(); virtual SOCKET GetFd() {return _socket;} - virtual WebRtc_Word32 GetError() {return _error;} + virtual int32_t GetError() {return _error;} virtual bool ValidHandle(); - virtual bool SetQos(WebRtc_Word32 /*serviceType*/, - WebRtc_Word32 /*tokenRate*/, - WebRtc_Word32 /*bucketSize*/, - WebRtc_Word32 /*peekBandwith*/, - WebRtc_Word32 /*minPolicedSize*/, - WebRtc_Word32 /*maxSduSize*/, + virtual bool SetQos(int32_t /*serviceType*/, + int32_t /*tokenRate*/, + int32_t /*bucketSize*/, + int32_t /*peekBandwith*/, + int32_t /*minPolicedSize*/, + int32_t /*maxSduSize*/, const SocketAddress& /*stRemName*/, - WebRtc_Word32 /*overrideDSCP*/) {return false;} + int32_t /*overrideDSCP*/) {return false;} bool CleanUp(); void HasIncoming(); @@ -72,10 +72,10 @@ public: private: friend class UdpSocketManagerPosix; - WebRtc_Word32 _id; + int32_t _id; IncomingSocketCallback _incomingCb; CallbackObj _obj; - WebRtc_Word32 _error; + int32_t _error; SOCKET _socket; UdpSocketManager* _mgr; diff --git a/webrtc/test/channel_transport/udp_socket_wrapper.cc b/webrtc/test/channel_transport/udp_socket_wrapper.cc index aae43d4aa..2bd925a4e 100644 --- a/webrtc/test/channel_transport/udp_socket_wrapper.cc +++ b/webrtc/test/channel_transport/udp_socket_wrapper.cc @@ -59,7 +59,7 @@ void UdpSocketWrapper::SetEventToNull() } } -UdpSocketWrapper* UdpSocketWrapper::CreateSocket(const WebRtc_Word32 id, +UdpSocketWrapper* UdpSocketWrapper::CreateSocket(const int32_t id, UdpSocketManager* mgr, CallbackObj obj, IncomingSocketCallback cb, @@ -77,7 +77,7 @@ UdpSocketWrapper* UdpSocketWrapper::CreateSocket(const WebRtc_Word32 id, { WSADATA wsaData; WORD wVersionRequested = MAKEWORD( 2, 2 ); - WebRtc_Word32 err = WSAStartup( wVersionRequested, &wsaData); + int32_t err = WSAStartup( wVersionRequested, &wsaData); if (err != 0) { WEBRTC_TRACE( diff --git a/webrtc/test/channel_transport/udp_socket_wrapper.h b/webrtc/test/channel_transport/udp_socket_wrapper.h index 39880b7ed..a0bb4c0ae 100644 --- a/webrtc/test/channel_transport/udp_socket_wrapper.h +++ b/webrtc/test/channel_transport/udp_socket_wrapper.h @@ -37,14 +37,13 @@ typedef int SOCKET; #endif typedef void* CallbackObj; -typedef void(*IncomingSocketCallback)(CallbackObj obj, const WebRtc_Word8* buf, - WebRtc_Word32 len, - const SocketAddress* from); +typedef void(*IncomingSocketCallback)(CallbackObj obj, const int8_t* buf, + int32_t len, const SocketAddress* from); class UdpSocketWrapper { public: - static UdpSocketWrapper* CreateSocket(const WebRtc_Word32 id, + static UdpSocketWrapper* CreateSocket(const int32_t id, UdpSocketManager* mgr, CallbackObj obj, IncomingSocketCallback cb, @@ -52,7 +51,7 @@ public: bool disableGQOS = false); // Set the unique identifier of this class to id. - virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id) = 0; + virtual int32_t ChangeUniqueId(const int32_t id) = 0; // Register cb for receiving callbacks when there are incoming packets. // Register obj so that it will be passed in calls to cb. @@ -63,7 +62,7 @@ public: // Start receiving UDP data. virtual bool StartReceiving(); - virtual inline bool StartReceiving(const WebRtc_UWord32 /*receiveBuffers*/) + virtual inline bool StartReceiving(const uint32_t /*receiveBuffers*/) {return StartReceiving();} // Stop receiving UDP data. virtual bool StopReceiving(); @@ -71,19 +70,18 @@ public: virtual bool ValidHandle() = 0; // Set socket options. - virtual bool SetSockopt(WebRtc_Word32 level, WebRtc_Word32 optname, - const WebRtc_Word8* optval, - WebRtc_Word32 optlen) = 0; + virtual bool SetSockopt(int32_t level, int32_t optname, + const int8_t* optval, int32_t optlen) = 0; // Set TOS for outgoing packets. - virtual WebRtc_Word32 SetTOS(const WebRtc_Word32 serviceType) = 0; + virtual int32_t SetTOS(const int32_t serviceType) = 0; // Set 802.1Q PCP field (802.1p) for outgoing VLAN traffic. - virtual WebRtc_Word32 SetPCP(const WebRtc_Word32 /*pcp*/) {return -1;} + virtual int32_t SetPCP(const int32_t /*pcp*/) {return -1;} // Send buf of length len to the address specified by to. - virtual WebRtc_Word32 SendTo(const WebRtc_Word8* buf, WebRtc_Word32 len, - const SocketAddress& to) = 0; + virtual int32_t SendTo(const int8_t* buf, int32_t len, + const SocketAddress& to) = 0; virtual void SetEventToNull(); @@ -91,13 +89,13 @@ public: virtual void CloseBlocking() {} // tokenRate is in bit/s. peakBandwidt is in byte/s - virtual bool SetQos(WebRtc_Word32 serviceType, WebRtc_Word32 tokenRate, - WebRtc_Word32 bucketSize, WebRtc_Word32 peekBandwith, - WebRtc_Word32 minPolicedSize, WebRtc_Word32 maxSduSize, + virtual bool SetQos(int32_t serviceType, int32_t tokenRate, + int32_t bucketSize, int32_t peekBandwith, + int32_t minPolicedSize, int32_t maxSduSize, const SocketAddress &stRemName, - WebRtc_Word32 overrideDSCP = 0) = 0; + int32_t overrideDSCP = 0) = 0; - virtual WebRtc_UWord32 ReceiveBuffers() {return 0;}; + virtual uint32_t ReceiveBuffers() {return 0;}; protected: // Creating the socket is done via CreateSocket(). diff --git a/webrtc/test/channel_transport/udp_socket_wrapper_unittest.cc b/webrtc/test/channel_transport/udp_socket_wrapper_unittest.cc index 759a222ec..22757d1e3 100644 --- a/webrtc/test/channel_transport/udp_socket_wrapper_unittest.cc +++ b/webrtc/test/channel_transport/udp_socket_wrapper_unittest.cc @@ -38,8 +38,8 @@ class MockSocketManager : public UdpSocketManager { void Destroy() { delete this; } - MOCK_METHOD2(Init, bool(WebRtc_Word32, WebRtc_UWord8&)); - MOCK_METHOD1(ChangeUniqueId, WebRtc_Word32(const WebRtc_Word32)); + MOCK_METHOD2(Init, bool(int32_t, uint8_t&)); + MOCK_METHOD1(ChangeUniqueId, int32_t(const int32_t)); MOCK_METHOD0(Start, bool()); MOCK_METHOD0(Stop, bool()); MOCK_METHOD1(AddSocket, bool(UdpSocketWrapper*)); @@ -49,9 +49,9 @@ class MockSocketManager : public UdpSocketManager { // Creates a socket using the static constructor method and verifies that // it's added to the socket manager. TEST(UdpSocketWrapper, CreateSocket) { - WebRtc_Word32 id = 42; + int32_t id = 42; // We can't test deletion of sockets without a socket manager. - WebRtc_UWord8 threads = 1; + uint8_t threads = 1; UdpSocketManager* mgr = UdpSocketManager::Create(id, threads); UdpSocketWrapper* socket = UdpSocketWrapper::CreateSocket(id, diff --git a/webrtc/test/channel_transport/udp_transport.h b/webrtc/test/channel_transport/udp_transport.h index 75859c9a0..d45326f95 100644 --- a/webrtc/test/channel_transport/udp_transport.h +++ b/webrtc/test/channel_transport/udp_transport.h @@ -22,9 +22,9 @@ */ #define SS_MAXSIZE 128 -#define SS_ALIGNSIZE (sizeof (WebRtc_UWord64)) -#define SS_PAD1SIZE (SS_ALIGNSIZE - sizeof(WebRtc_Word16)) -#define SS_PAD2SIZE (SS_MAXSIZE - (sizeof(WebRtc_Word16) + SS_PAD1SIZE +\ +#define SS_ALIGNSIZE (sizeof (uint64_t)) +#define SS_PAD1SIZE (SS_ALIGNSIZE - sizeof(int16_t)) +#define SS_PAD2SIZE (SS_MAXSIZE - (sizeof(int16_t) + SS_PAD1SIZE +\ SS_ALIGNSIZE)) // BSD requires use of HAVE_STRUCT_SOCKADDR_SA_LEN @@ -34,53 +34,53 @@ namespace test { struct SocketAddressIn { // sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6) #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN - WebRtc_Word8 sin_length; - WebRtc_Word8 sin_family; + int8_t sin_length; + int8_t sin_family; #else - WebRtc_Word16 sin_family; + int16_t sin_family; #endif - WebRtc_UWord16 sin_port; - WebRtc_UWord32 sin_addr; - WebRtc_Word8 sin_zero[8]; + uint16_t sin_port; + uint32_t sin_addr; + int8_t sin_zero[8]; }; struct Version6InAddress { union { - WebRtc_UWord8 _s6_u8[16]; - WebRtc_UWord32 _s6_u32[4]; - WebRtc_UWord64 _s6_u64[2]; + uint8_t _s6_u8[16]; + uint32_t _s6_u32[4]; + uint64_t _s6_u64[2]; } Version6AddressUnion; }; struct SocketAddressInVersion6 { // sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6) #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN - WebRtc_Word8 sin_length; - WebRtc_Word8 sin_family; + int8_t sin_length; + int8_t sin_family; #else - WebRtc_Word16 sin_family; + int16_t sin_family; #endif // Transport layer port number. - WebRtc_UWord16 sin6_port; + uint16_t sin6_port; // IPv6 traffic class and flow info or ip4 address. - WebRtc_UWord32 sin6_flowinfo; + uint32_t sin6_flowinfo; // IPv6 address struct Version6InAddress sin6_addr; // Set of interfaces for a scope. - WebRtc_UWord32 sin6_scope_id; + uint32_t sin6_scope_id; }; struct SocketAddressStorage { // sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6) #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN - WebRtc_Word8 sin_length; - WebRtc_Word8 sin_family; + int8_t sin_length; + int8_t sin_family; #else - WebRtc_Word16 sin_family; + int16_t sin_family; #endif - WebRtc_Word8 __ss_pad1[SS_PAD1SIZE]; - WebRtc_UWord64 __ss_align; - WebRtc_Word8 __ss_pad2[SS_PAD2SIZE]; + int8_t __ss_pad1[SS_PAD1SIZE]; + uint64_t __ss_align; + int8_t __ss_pad2[SS_PAD2SIZE]; }; struct SocketAddress { @@ -96,15 +96,15 @@ class UdpTransportData { public: virtual ~UdpTransportData() {}; - virtual void IncomingRTPPacket(const WebRtc_Word8* incomingRtpPacket, - const WebRtc_Word32 rtpPacketLength, + virtual void IncomingRTPPacket(const int8_t* incomingRtpPacket, + const int32_t rtpPacketLength, const char* fromIP, - const WebRtc_UWord16 fromPort) = 0; + const uint16_t fromPort) = 0; - virtual void IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket, - const WebRtc_Word32 rtcpPacketLength, + virtual void IncomingRTCPPacket(const int8_t* incomingRtcpPacket, + const int32_t rtcpPacketLength, const char* fromIP, - const WebRtc_UWord16 fromPort) = 0; + const uint16_t fromPort) = 0; }; class UdpTransport : public Transport { @@ -137,140 +137,134 @@ class UdpTransport : public Transport { }; // Factory method. Constructor disabled. - static UdpTransport* Create(const WebRtc_Word32 id, - WebRtc_UWord8& numSocketThreads); + static UdpTransport* Create(const int32_t id, uint8_t& numSocketThreads); static void Destroy(UdpTransport* module); // Prepares the class for sending RTP packets to ipAddr:rtpPort and RTCP // packets to ipAddr:rtpPort+1 if rtcpPort is zero. Otherwise to // ipAddr:rtcpPort. - virtual WebRtc_Word32 InitializeSendSockets( - const char* ipAddr, - const WebRtc_UWord16 rtpPort, - const WebRtc_UWord16 rtcpPort = 0) = 0; + virtual int32_t InitializeSendSockets(const char* ipAddr, + const uint16_t rtpPort, + const uint16_t rtcpPort = 0) = 0; // Register packetCallback for receiving incoming packets. Set the local // RTP port to rtpPort. Bind local IP address to ipAddr. If ipAddr is NULL // bind to local IP ANY. Set the local rtcp port to rtcpPort or rtpPort + 1 // if rtcpPort is 0. - virtual WebRtc_Word32 InitializeReceiveSockets( + virtual int32_t InitializeReceiveSockets( UdpTransportData* const packetCallback, - const WebRtc_UWord16 rtpPort, + const uint16_t rtpPort, const char* ipAddr = NULL, const char* multicastIpAddr = NULL, - const WebRtc_UWord16 rtcpPort = 0) = 0; + const uint16_t rtcpPort = 0) = 0; // Set local RTP port to rtpPort and RTCP port to rtcpPort or rtpPort + 1 if // rtcpPort is 0. These ports will be used for sending instead of the local // ports set by InitializeReceiveSockets(..). - virtual WebRtc_Word32 InitializeSourcePorts( - const WebRtc_UWord16 rtpPort, - const WebRtc_UWord16 rtcpPort = 0) = 0; + virtual int32_t InitializeSourcePorts(const uint16_t rtpPort, + const uint16_t rtcpPort = 0) = 0; // Retrieve local ports used for sending if other than the ports specified // by InitializeReceiveSockets(..). rtpPort is set to the RTP port. // rtcpPort is set to the RTCP port. - virtual WebRtc_Word32 SourcePorts(WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort) const = 0; + virtual int32_t SourcePorts(uint16_t& rtpPort, + uint16_t& rtcpPort) const = 0; // Set ipAddr to the IP address that is currently being listened on. rtpPort // to the RTP port listened to. rtcpPort to the RTCP port listened on. // multicastIpAddr to the multicast IP address group joined (the address // is NULL terminated). - virtual WebRtc_Word32 ReceiveSocketInformation( + virtual int32_t ReceiveSocketInformation( char ipAddr[kIpAddressVersion6Length], - WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort, + uint16_t& rtpPort, + uint16_t& rtcpPort, char multicastIpAddr[kIpAddressVersion6Length]) const = 0; // Set ipAddr to the IP address being sent from. rtpPort to the local RTP // port used for sending and rtcpPort to the local RTCP port used for // sending. - virtual WebRtc_Word32 SendSocketInformation( - char ipAddr[kIpAddressVersion6Length], - WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort) const = 0; + virtual int32_t SendSocketInformation(char ipAddr[kIpAddressVersion6Length], + uint16_t& rtpPort, + uint16_t& rtcpPort) const = 0; // Put the IP address, RTP port and RTCP port from the last received packet // into ipAddr, rtpPort and rtcpPort respectively. - virtual WebRtc_Word32 RemoteSocketInformation( + virtual int32_t RemoteSocketInformation( char ipAddr[kIpAddressVersion6Length], - WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort) const = 0; + uint16_t& rtpPort, + uint16_t& rtcpPort) const = 0; // Enable/disable quality of service if QoS is true or false respectively. // Set the type of service to serviceType, max bitrate in kbit/s to // maxBitrate and override DSCP if overrideDSCP is not 0. // Note: Must be called both InitializeSendSockets() and // InitializeReceiveSockets() has been called. - virtual WebRtc_Word32 SetQoS(const bool QoS, - const WebRtc_Word32 serviceType, - const WebRtc_UWord32 maxBitrate = 0, - const WebRtc_Word32 overrideDSCP = 0, - const bool audio = false) = 0; + virtual int32_t SetQoS(const bool QoS, + const int32_t serviceType, + const uint32_t maxBitrate = 0, + const int32_t overrideDSCP = 0, + const bool audio = false) = 0; // Set QoS to true if quality of service has been turned on. If QoS is true, // also set serviceType to type of service and overrideDSCP to override // DSCP. - virtual WebRtc_Word32 QoS(bool& QoS, - WebRtc_Word32& serviceType, - WebRtc_Word32& overrideDSCP) const = 0; + virtual int32_t QoS(bool& QoS, + int32_t& serviceType, + int32_t& overrideDSCP) const = 0; // Set type of service. - virtual WebRtc_Word32 SetToS(const WebRtc_Word32 DSCP, - const bool useSetSockOpt = false) = 0; + virtual int32_t SetToS(const int32_t DSCP, + const bool useSetSockOpt = false) = 0; // Get type of service configuration. - virtual WebRtc_Word32 ToS(WebRtc_Word32& DSCP, - bool& useSetSockOpt) const = 0; + virtual int32_t ToS(int32_t& DSCP, + bool& useSetSockOpt) const = 0; // Set Priority Code Point (IEEE 802.1Q) // Note: for Linux this function will set the priority for the socket, // which then can be mapped to a PCP value with vconfig. - virtual WebRtc_Word32 SetPCP(const WebRtc_Word32 PCP) = 0; + virtual int32_t SetPCP(const int32_t PCP) = 0; // Get Priority Code Point - virtual WebRtc_Word32 PCP(WebRtc_Word32& PCP) const = 0; + virtual int32_t PCP(int32_t& PCP) const = 0; // Enable IPv6. // Note: this API must be called before any call to // InitializeReceiveSockets() or InitializeSendSockets(). It is not // possible to go back to IPv4 (default) after this call. - virtual WebRtc_Word32 EnableIpV6() = 0; + virtual int32_t EnableIpV6() = 0; // Return true if IPv6 has been enabled. virtual bool IpV6Enabled() const = 0; // Only allow packets received from filterIPAddress to be processed. // Note: must be called after EnableIPv6(), if IPv6 is used. - virtual WebRtc_Word32 SetFilterIP( + virtual int32_t SetFilterIP( const char filterIPAddress[kIpAddressVersion6Length]) = 0; // Write the filter IP address (if any) to filterIPAddress. - virtual WebRtc_Word32 FilterIP( + virtual int32_t FilterIP( char filterIPAddress[kIpAddressVersion6Length]) const = 0; // Only allow RTP packets from rtpFilterPort and RTCP packets from // rtcpFilterPort be processed. // Note: must be called after EnableIPv6(), if IPv6 is used. - virtual WebRtc_Word32 SetFilterPorts( - const WebRtc_UWord16 rtpFilterPort, - const WebRtc_UWord16 rtcpFilterPort) = 0; + virtual int32_t SetFilterPorts(const uint16_t rtpFilterPort, + const uint16_t rtcpFilterPort) = 0; // Set rtpFilterPort to the filter RTP port and rtcpFilterPort to the // filter RTCP port (if filtering based on port is enabled). - virtual WebRtc_Word32 FilterPorts(WebRtc_UWord16& rtpFilterPort, - WebRtc_UWord16& rtcpFilterPort) const = 0; + virtual int32_t FilterPorts(uint16_t& rtpFilterPort, + uint16_t& rtcpFilterPort) const = 0; // Set the number of buffers that the socket implementation may use for // receiving packets to numberOfSocketBuffers. I.e. the number of packets // that can be received in parallell. // Note: this API only has effect on Windows. - virtual WebRtc_Word32 StartReceiving( - const WebRtc_UWord32 numberOfSocketBuffers) = 0; + virtual int32_t StartReceiving(const uint32_t numberOfSocketBuffers) = 0; // Stop receive incoming packets. - virtual WebRtc_Word32 StopReceiving() = 0; + virtual int32_t StopReceiving() = 0; // Return true incoming packets are received. virtual bool Receiving() const = 0; @@ -288,79 +282,79 @@ class UdpTransport : public Transport { // with InitializeSendSockets(..) is used if portnr is 0. The same IP // address as set with InitializeSendSockets(..) is used if ip is NULL. // If isRTCP is true the port used will be the RTCP port. - virtual WebRtc_Word32 SendRaw(const WebRtc_Word8* data, - WebRtc_UWord32 length, - WebRtc_Word32 isRTCP, - WebRtc_UWord16 portnr = 0, - const char* ip = NULL) = 0; + virtual int32_t SendRaw(const int8_t* data, + uint32_t length, + int32_t isRTCP, + uint16_t portnr = 0, + const char* ip = NULL) = 0; // Send RTP data with size length to the address specified by to. - virtual WebRtc_Word32 SendRTPPacketTo(const WebRtc_Word8* data, - WebRtc_UWord32 length, - const SocketAddress& to) = 0; + virtual int32_t SendRTPPacketTo(const int8_t* data, + uint32_t length, + const SocketAddress& to) = 0; // Send RTCP data with size length to the address specified by to. - virtual WebRtc_Word32 SendRTCPPacketTo(const WebRtc_Word8* data, - WebRtc_UWord32 length, - const SocketAddress& to) = 0; + virtual int32_t SendRTCPPacketTo(const int8_t* data, + uint32_t length, + const SocketAddress& to) = 0; // Send RTP data with size length to ip:rtpPort where ip is the ip set by // the InitializeSendSockets(..) call. - virtual WebRtc_Word32 SendRTPPacketTo(const WebRtc_Word8* data, - WebRtc_UWord32 length, - WebRtc_UWord16 rtpPort) = 0; + virtual int32_t SendRTPPacketTo(const int8_t* data, + uint32_t length, + uint16_t rtpPort) = 0; // Send RTCP data with size length to ip:rtcpPort where ip is the ip set by // the InitializeSendSockets(..) call. - virtual WebRtc_Word32 SendRTCPPacketTo(const WebRtc_Word8* data, - WebRtc_UWord32 length, - WebRtc_UWord16 rtcpPort) = 0; + virtual int32_t SendRTCPPacketTo(const int8_t* data, + uint32_t length, + uint16_t rtcpPort) = 0; // Set the IP address to which packets are sent to ipaddr. - virtual WebRtc_Word32 SetSendIP( + virtual int32_t SetSendIP( const char ipaddr[kIpAddressVersion6Length]) = 0; // Set the send RTP and RTCP port to rtpPort and rtcpPort respectively. - virtual WebRtc_Word32 SetSendPorts(const WebRtc_UWord16 rtpPort, - const WebRtc_UWord16 rtcpPort = 0) = 0; + virtual int32_t SetSendPorts(const uint16_t rtpPort, + const uint16_t rtcpPort = 0) = 0; // Retreive the last registered error code. virtual ErrorCode LastError() const = 0; // Put the local IPv4 address in localIP. // Note: this API is for IPv4 only. - static WebRtc_Word32 LocalHostAddress(WebRtc_UWord32& localIP); + static int32_t LocalHostAddress(uint32_t& localIP); // Put the local IP6 address in localIP. // Note: this API is for IPv6 only. - static WebRtc_Word32 LocalHostAddressIPV6(char localIP[16]); + static int32_t LocalHostAddressIPV6(char localIP[16]); // Return a copy of hostOrder (host order) in network order. - static WebRtc_UWord16 Htons(WebRtc_UWord16 hostOrder); + static uint16_t Htons(uint16_t hostOrder); // Return a copy of hostOrder (host order) in network order. - static WebRtc_UWord32 Htonl(WebRtc_UWord32 hostOrder); + static uint32_t Htonl(uint32_t hostOrder); // Return IPv4 address in ip as 32 bit integer. - static WebRtc_UWord32 InetAddrIPV4(const char* ip); + static uint32_t InetAddrIPV4(const char* ip); // Convert the character string src into a network address structure in // the af address family and put it in dst. // Note: same functionality as inet_pton(..) - static WebRtc_Word32 InetPresentationToNumeric(WebRtc_Word32 af, - const char* src, - void* dst); + static int32_t InetPresentationToNumeric(int32_t af, + const char* src, + void* dst); // Set ip and sourcePort according to address. As input parameter ipSize // is the length of ip. As output parameter it's the number of characters // written to ip (not counting the '\0' character). // Note: this API is only implemented on Windows and Linux. - static WebRtc_Word32 IPAddress(const SocketAddress& address, - char* ip, - WebRtc_UWord32& ipSize, - WebRtc_UWord16& sourcePort); + static int32_t IPAddress(const SocketAddress& address, + char* ip, + uint32_t& ipSize, + uint16_t& sourcePort); // Set ip and sourcePort according to address. As input parameter ipSize // is the length of ip. As output parameter it's the number of characters @@ -369,10 +363,10 @@ class UdpTransport : public Transport { // Additional note: this API caches the address of the last call to it. If // address is likley to be the same for multiple calls it may be beneficial // to call this API instead of IPAddress(). - virtual WebRtc_Word32 IPAddressCached(const SocketAddress& address, - char* ip, - WebRtc_UWord32& ipSize, - WebRtc_UWord16& sourcePort) = 0; + virtual int32_t IPAddressCached(const SocketAddress& address, + char* ip, + uint32_t& ipSize, + uint16_t& sourcePort) = 0; // Return true if ipaddr is a valid IP address. // If ipV6 is false ipaddr is interpreted as an IPv4 address otherwise it diff --git a/webrtc/test/channel_transport/udp_transport_impl.cc b/webrtc/test/channel_transport/udp_transport_impl.cc index 3c0419a7a..ec73200e3 100644 --- a/webrtc/test/channel_transport/udp_transport_impl.cc +++ b/webrtc/test/channel_transport/udp_transport_impl.cc @@ -68,7 +68,7 @@ namespace test { class SocketFactory : public UdpTransportImpl::SocketFactoryInterface { public: - UdpSocketWrapper* CreateSocket(const WebRtc_Word32 id, + UdpSocketWrapper* CreateSocket(const int32_t id, UdpSocketManager* mgr, CallbackObj obj, IncomingSocketCallback cb, @@ -82,8 +82,8 @@ class SocketFactory : public UdpTransportImpl::SocketFactoryInterface { // Creates an UdpTransport using the definition of SocketFactory above, // and passes (creating if needed) a pointer to the static singleton // UdpSocketManager. -UdpTransport* UdpTransport::Create(const WebRtc_Word32 id, - WebRtc_UWord8& numSocketThreads) +UdpTransport* UdpTransport::Create(const int32_t id, + uint8_t& numSocketThreads) { return new UdpTransportImpl(id, new SocketFactory(), @@ -102,7 +102,7 @@ void UdpTransport::Destroy(UdpTransport* module) } } -UdpTransportImpl::UdpTransportImpl(const WebRtc_Word32 id, +UdpTransportImpl::UdpTransportImpl(const int32_t id, SocketFactoryInterface* maker, UdpSocketManager* socket_manager) : _id(id), @@ -191,22 +191,22 @@ bool SameAddress(const SocketAddress& address1, const SocketAddress& address2) } void UdpTransportImpl::GetCachedAddress(char* ip, - WebRtc_UWord32& ipSize, - WebRtc_UWord16& sourcePort) + uint32_t& ipSize, + uint16_t& sourcePort) { - const WebRtc_UWord32 originalIPSize = ipSize; + const uint32_t originalIPSize = ipSize; // If the incoming string is too small, fill it as much as there is room // for. Make sure that there is room for the '\0' character. ipSize = (ipSize - 1 < _previousIPSize) ? ipSize - 1 : _previousIPSize; - memcpy(ip,_previousIP,sizeof(WebRtc_Word8)*(ipSize + 1)); + memcpy(ip,_previousIP,sizeof(int8_t)*(ipSize + 1)); ip[originalIPSize - 1] = '\0'; sourcePort = _previousSourcePort; } -WebRtc_Word32 UdpTransportImpl::IPAddressCached(const SocketAddress& address, - char* ip, - WebRtc_UWord32& ipSize, - WebRtc_UWord16& sourcePort) +int32_t UdpTransportImpl::IPAddressCached(const SocketAddress& address, + char* ip, + uint32_t& ipSize, + uint16_t& sourcePort) { { ReadLockScoped rl(*_cachLock); @@ -231,12 +231,12 @@ WebRtc_Word32 UdpTransportImpl::IPAddressCached(const SocketAddress& address, return 0; } -WebRtc_Word32 UdpTransportImpl::InitializeReceiveSockets( +int32_t UdpTransportImpl::InitializeReceiveSockets( UdpTransportData* const packetCallback, - const WebRtc_UWord16 portnr, + const uint16_t portnr, const char* ip, const char* multicastIpAddr, - const WebRtc_UWord16 rtcpPort) + const uint16_t rtcpPort) { { CriticalSectionScoped cs(_critPacketCallback); @@ -359,10 +359,10 @@ WebRtc_Word32 UdpTransportImpl::InitializeReceiveSockets( return 0; } -WebRtc_Word32 UdpTransportImpl::ReceiveSocketInformation( +int32_t UdpTransportImpl::ReceiveSocketInformation( char ipAddr[kIpAddressVersion6Length], - WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort, + uint16_t& rtpPort, + uint16_t& rtcpPort, char multicastIpAddr[kIpAddressVersion6Length]) const { CriticalSectionScoped cs(_crit); @@ -383,10 +383,10 @@ WebRtc_Word32 UdpTransportImpl::ReceiveSocketInformation( return 0; } -WebRtc_Word32 UdpTransportImpl::SendSocketInformation( +int32_t UdpTransportImpl::SendSocketInformation( char ipAddr[kIpAddressVersion6Length], - WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort) const + uint16_t& rtpPort, + uint16_t& rtcpPort) const { CriticalSectionScoped cs(_crit); rtpPort = _destPort; @@ -397,10 +397,10 @@ WebRtc_Word32 UdpTransportImpl::SendSocketInformation( return 0; } -WebRtc_Word32 UdpTransportImpl::RemoteSocketInformation( +int32_t UdpTransportImpl::RemoteSocketInformation( char ipAddr[kIpAddressVersion6Length], - WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort) const + uint16_t& rtpPort, + uint16_t& rtcpPort) const { CriticalSectionScoped cs(_crit); rtpPort = _fromPort; @@ -414,9 +414,9 @@ WebRtc_Word32 UdpTransportImpl::RemoteSocketInformation( return 0; } -WebRtc_Word32 UdpTransportImpl::FilterPorts( - WebRtc_UWord16& rtpFilterPort, - WebRtc_UWord16& rtcpFilterPort) const +int32_t UdpTransportImpl::FilterPorts( + uint16_t& rtpFilterPort, + uint16_t& rtcpFilterPort) const { CriticalSectionScoped cs(_critFilter); rtpFilterPort = _rtpFilterPort; @@ -424,9 +424,9 @@ WebRtc_Word32 UdpTransportImpl::FilterPorts( return 0; } -WebRtc_Word32 UdpTransportImpl::SetQoS(bool QoS, WebRtc_Word32 serviceType, - WebRtc_UWord32 maxBitrate, - WebRtc_Word32 overrideDSCP, bool audio) +int32_t UdpTransportImpl::SetQoS(bool QoS, int32_t serviceType, + uint32_t maxBitrate, + int32_t overrideDSCP, bool audio) { if(QoS) { @@ -437,9 +437,9 @@ WebRtc_Word32 UdpTransportImpl::SetQoS(bool QoS, WebRtc_Word32 serviceType, } } -WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType, - bool audio, WebRtc_UWord32 maxBitrate, - WebRtc_Word32 overrideDSCP) +int32_t UdpTransportImpl::EnableQoS(int32_t serviceType, + bool audio, uint32_t maxBitrate, + int32_t overrideDSCP) { if (_ipV6Enabled) { @@ -524,10 +524,10 @@ WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType, // Minimum packet size in bytes for which the requested quality of service // will be provided. The smallest RTP header is 12 byte. - const WebRtc_Word32 min_policed_size = 12; + const int32_t min_policed_size = 12; // Max SDU, maximum packet size permitted or used in the traffic flow, in // bytes. - const WebRtc_Word32 max_sdu_size = 1500; + const int32_t max_sdu_size = 1500; // Enable QoS for RTP sockets. if(maxBitrate) @@ -544,13 +544,13 @@ WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType, "Enable QOS for audio with max bitrate:%d", maxBitrate); - const WebRtc_Word32 token_rate = maxBitrate*125; + const int32_t token_rate = maxBitrate*125; // The largest audio packets are 60ms frames. This is a fraction // more than 16 packets/second. These 16 frames are sent, at max, // at a bitrate of maxBitrate*125 -> 1 frame is maxBitrate*125/16 ~ // maxBitrate * 8. - const WebRtc_Word32 bucket_size = maxBitrate * 8; - const WebRtc_Word32 peek_bandwith = maxBitrate * 125; + const int32_t bucket_size = maxBitrate * 8; + const int32_t peek_bandwith = maxBitrate * 125; if (!rtpSock->SetQos(serviceType, token_rate, bucket_size, peek_bandwith, min_policed_size, max_sdu_size, _remoteRTPAddr, overrideDSCP)) @@ -568,14 +568,14 @@ WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType, // Allow for a token rate that is twice that of the maximum bitrate // (in bytes). - const WebRtc_Word32 token_rate = maxBitrate*250; + const int32_t token_rate = maxBitrate*250; // largest average frame size (key frame size). Assuming that a // keyframe is 25% of the bitrate during the second its sent // Assume that a key frame is 25% of the bitrate the second that it // is sent. The largest frame size is then maxBitrate* 125 * 0.25 ~ // 31. - const WebRtc_Word32 bucket_size = maxBitrate*31; - const WebRtc_Word32 peek_bandwith = maxBitrate*125; + const int32_t bucket_size = maxBitrate*31; + const int32_t peek_bandwith = maxBitrate*125; if (!rtpSock->SetQos(serviceType, token_rate, bucket_size, peek_bandwith, min_policed_size, max_sdu_size, _remoteRTPAddr, overrideDSCP)) @@ -593,9 +593,9 @@ WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType, "Enable QOS for audio with default max bitrate"); // Let max bitrate be 240kbit/s. - const WebRtc_Word32 token_rate = 30000; - const WebRtc_Word32 bucket_size = 2000; - const WebRtc_Word32 peek_bandwith = 30000; + const int32_t token_rate = 30000; + const int32_t bucket_size = 2000; + const int32_t peek_bandwith = 30000; if (!rtpSock->SetQos(serviceType, token_rate, bucket_size, peek_bandwith, min_policed_size, max_sdu_size, _remoteRTPAddr, overrideDSCP)) @@ -612,9 +612,9 @@ WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType, "Enable QOS for video with default max bitrate"); // Let max bitrate be 10mbit/s. - const WebRtc_Word32 token_rate = 128000*10; - const WebRtc_Word32 bucket_size = 32000; - const WebRtc_Word32 peek_bandwith = 256000; + const int32_t token_rate = 128000*10; + const int32_t bucket_size = 32000; + const int32_t peek_bandwith = 256000; if (!rtpSock->SetQos(serviceType, token_rate, bucket_size, peek_bandwith, min_policed_size, max_sdu_size, _remoteRTPAddr, overrideDSCP)) @@ -630,9 +630,9 @@ WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType, // TODO (hellner): shouldn't RTCP be based on 5% of the maximum bandwidth? if(audio) { - const WebRtc_Word32 token_rate = 200; - const WebRtc_Word32 bucket_size = 200; - const WebRtc_Word32 peek_bandwith = 400; + const int32_t token_rate = 200; + const int32_t bucket_size = 200; + const int32_t peek_bandwith = 400; if (!rtcpSock->SetQos(serviceType, token_rate, bucket_size, peek_bandwith, min_policed_size, max_sdu_size, _remoteRTCPAddr, overrideDSCP)) @@ -643,9 +643,9 @@ WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType, } }else { - const WebRtc_Word32 token_rate = 5000; - const WebRtc_Word32 bucket_size = 100; - const WebRtc_Word32 peek_bandwith = 10000; + const int32_t token_rate = 5000; + const int32_t bucket_size = 100; + const int32_t peek_bandwith = 10000; if (!rtcpSock->SetQos(serviceType, token_rate, bucket_size, peek_bandwith, min_policed_size, max_sdu_size, _remoteRTCPAddr, _overrideDSCP)) @@ -662,7 +662,7 @@ WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType, return 0; } -WebRtc_Word32 UdpTransportImpl::DisableQoS() +int32_t UdpTransportImpl::DisableQoS() { if(_qos == false) { @@ -695,8 +695,8 @@ WebRtc_Word32 UdpTransportImpl::DisableQoS() return -1; } - const WebRtc_Word32 service_type = 0; // = SERVICETYPE_NOTRAFFIC - const WebRtc_Word32 not_specified = -1; + const int32_t service_type = 0; // = SERVICETYPE_NOTRAFFIC + const int32_t not_specified = -1; if (!rtpSock->SetQos(service_type, not_specified, not_specified, not_specified, not_specified, not_specified, _remoteRTPAddr, _overrideDSCP)) @@ -714,8 +714,8 @@ WebRtc_Word32 UdpTransportImpl::DisableQoS() return 0; } -WebRtc_Word32 UdpTransportImpl::QoS(bool& QoS, WebRtc_Word32& serviceType, - WebRtc_Word32& overrideDSCP) const +int32_t UdpTransportImpl::QoS(bool& QoS, int32_t& serviceType, + int32_t& overrideDSCP) const { CriticalSectionScoped cs(_crit); QoS = _qos; @@ -724,7 +724,7 @@ WebRtc_Word32 UdpTransportImpl::QoS(bool& QoS, WebRtc_Word32& serviceType, return 0; } -WebRtc_Word32 UdpTransportImpl::SetToS(WebRtc_Word32 DSCP, bool useSetSockOpt) +int32_t UdpTransportImpl::SetToS(int32_t DSCP, bool useSetSockOpt) { if (_qos) { @@ -835,7 +835,7 @@ WebRtc_Word32 UdpTransportImpl::SetToS(WebRtc_Word32 DSCP, bool useSetSockOpt) else { bool receiving=_receiving; - WebRtc_UWord32 noOfReceiveBuffers = 0; + uint32_t noOfReceiveBuffers = 0; if(receiving) { noOfReceiveBuffers=_ptrRtpSocket->ReceiveBuffers(); @@ -879,9 +879,9 @@ WebRtc_Word32 UdpTransportImpl::SetToS(WebRtc_Word32 DSCP, bool useSetSockOpt) #endif // #ifdef _WIN32 WEBRTC_TRACE(kTraceDebug, kTraceTransport, _id, "Setting TOS using SetSockopt"); - WebRtc_Word32 TOSShifted = DSCP << 2; + int32_t TOSShifted = DSCP << 2; if (!rtpSock->SetSockopt(IPPROTO_IP, IP_TOS, - (WebRtc_Word8*) &TOSShifted, 4)) + (int8_t*) &TOSShifted, 4)) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "Could not SetSockopt tos value on RTP socket"); @@ -889,7 +889,7 @@ WebRtc_Word32 UdpTransportImpl::SetToS(WebRtc_Word32 DSCP, bool useSetSockOpt) return -1; } if (!rtcpSock->SetSockopt(IPPROTO_IP, IP_TOS, - (WebRtc_Word8*) &TOSShifted, 4)) + (int8_t*) &TOSShifted, 4)) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "Could not sSetSockopt tos value on RTCP socket"); @@ -920,8 +920,8 @@ WebRtc_Word32 UdpTransportImpl::SetToS(WebRtc_Word32 DSCP, bool useSetSockOpt) return 0; } -WebRtc_Word32 UdpTransportImpl::ToS(WebRtc_Word32& DSCP, - bool& useSetSockOpt) const +int32_t UdpTransportImpl::ToS(int32_t& DSCP, + bool& useSetSockOpt) const { CriticalSectionScoped cs(_crit); DSCP = _tos; @@ -929,7 +929,7 @@ WebRtc_Word32 UdpTransportImpl::ToS(WebRtc_Word32& DSCP, return 0; } -WebRtc_Word32 UdpTransportImpl::SetPCP(WebRtc_Word32 PCP) +int32_t UdpTransportImpl::SetPCP(int32_t PCP) { if (_qos) @@ -1000,7 +1000,7 @@ WebRtc_Word32 UdpTransportImpl::SetPCP(WebRtc_Word32 PCP) } #elif defined(WEBRTC_LINUX) - if (!rtpSock->SetSockopt(SOL_SOCKET, SO_PRIORITY, (WebRtc_Word8*) &PCP, + if (!rtpSock->SetSockopt(SOL_SOCKET, SO_PRIORITY, (int8_t*) &PCP, sizeof(PCP))) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, @@ -1008,7 +1008,7 @@ WebRtc_Word32 UdpTransportImpl::SetPCP(WebRtc_Word32 PCP) _lastError = kPcpError; return -1; } - if (!rtcpSock->SetSockopt(SOL_SOCKET, SO_PRIORITY, (WebRtc_Word8*) &PCP, + if (!rtcpSock->SetSockopt(SOL_SOCKET, SO_PRIORITY, (int8_t*) &PCP, sizeof(PCP))) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, @@ -1025,7 +1025,7 @@ WebRtc_Word32 UdpTransportImpl::SetPCP(WebRtc_Word32 PCP) return 0; } -WebRtc_Word32 UdpTransportImpl::PCP(WebRtc_Word32& PCP) const +int32_t UdpTransportImpl::PCP(int32_t& PCP) const { CriticalSectionScoped cs(_crit); PCP = _pcp; @@ -1037,7 +1037,7 @@ bool UdpTransportImpl::SetSockOptUsed() return _useSetSockOpt; } -WebRtc_Word32 UdpTransportImpl::EnableIpV6() { +int32_t UdpTransportImpl::EnableIpV6() { CriticalSectionScoped cs(_crit); const bool initialized = (_ptrSendRtpSocket || _ptrRtpSocket); @@ -1053,7 +1053,7 @@ WebRtc_Word32 UdpTransportImpl::EnableIpV6() { return 0; } -WebRtc_Word32 UdpTransportImpl::FilterIP( +int32_t UdpTransportImpl::FilterIP( char filterIPAddress[kIpAddressVersion6Length]) const { @@ -1069,12 +1069,12 @@ WebRtc_Word32 UdpTransportImpl::FilterIP( return -1; } CriticalSectionScoped cs(_critFilter); - WebRtc_UWord32 ipSize = kIpAddressVersion6Length; - WebRtc_UWord16 sourcePort; + uint32_t ipSize = kIpAddressVersion6Length; + uint16_t sourcePort; return IPAddress(_filterIPAddress, filterIPAddress, ipSize, sourcePort); } -WebRtc_Word32 UdpTransportImpl::SetFilterIP( +int32_t UdpTransportImpl::SetFilterIP( const char filterIPAddress[kIpAddressVersion6Length]) { if(filterIPAddress == NULL) @@ -1118,8 +1118,8 @@ WebRtc_Word32 UdpTransportImpl::SetFilterIP( return 0; } -WebRtc_Word32 UdpTransportImpl::SetFilterPorts(WebRtc_UWord16 rtpFilterPort, - WebRtc_UWord16 rtcpFilterPort) +int32_t UdpTransportImpl::SetFilterPorts(uint16_t rtpFilterPort, + uint16_t rtcpFilterPort) { CriticalSectionScoped cs(_critFilter); _rtpFilterPort = rtpFilterPort; @@ -1388,7 +1388,7 @@ UdpTransportImpl::ErrorCode UdpTransportImpl::BindLocalRTPSocket() mreq.imr_interface.s_addr = INADDR_ANY; if (!_ptrRtpSocket->SetSockopt(IPPROTO_IP,IP_ADD_MEMBERSHIP, - (WebRtc_Word8*)&mreq,sizeof (mreq))) + (int8_t*)&mreq,sizeof (mreq))) { WEBRTC_TRACE( kTraceError, @@ -1460,7 +1460,7 @@ UdpTransportImpl::ErrorCode UdpTransportImpl::BindLocalRTCPSocket() mreq.imr_interface.s_addr = INADDR_ANY; if (!_ptrRtcpSocket->SetSockopt(IPPROTO_IP,IP_ADD_MEMBERSHIP, - (WebRtc_Word8*)&mreq,sizeof (mreq))) + (int8_t*)&mreq,sizeof (mreq))) { WEBRTC_TRACE( kTraceError, @@ -1476,8 +1476,8 @@ UdpTransportImpl::ErrorCode UdpTransportImpl::BindLocalRTCPSocket() return kNoSocketError; } -WebRtc_Word32 UdpTransportImpl::InitializeSourcePorts(WebRtc_UWord16 rtpPort, - WebRtc_UWord16 rtcpPort) +int32_t UdpTransportImpl::InitializeSourcePorts(uint16_t rtpPort, + uint16_t rtcpPort) { if(rtpPort == 0) @@ -1529,8 +1529,8 @@ WebRtc_Word32 UdpTransportImpl::InitializeSourcePorts(WebRtc_UWord16 rtpPort, return 0; } -WebRtc_Word32 UdpTransportImpl::SourcePorts(WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort) const +int32_t UdpTransportImpl::SourcePorts(uint16_t& rtpPort, + uint16_t& rtcpPort) const { CriticalSectionScoped cs(_crit); @@ -1541,11 +1541,9 @@ WebRtc_Word32 UdpTransportImpl::SourcePorts(WebRtc_UWord16& rtpPort, #ifdef _WIN32 -WebRtc_Word32 UdpTransportImpl::StartReceiving( - WebRtc_UWord32 numberOfSocketBuffers) +int32_t UdpTransportImpl::StartReceiving(uint32_t numberOfSocketBuffers) #else -WebRtc_Word32 UdpTransportImpl::StartReceiving( - WebRtc_UWord32 /*numberOfSocketBuffers*/) +int32_t UdpTransportImpl::StartReceiving(uint32_t /*numberOfSocketBuffers*/) #endif { CriticalSectionScoped cs(_crit); @@ -1594,7 +1592,7 @@ bool UdpTransportImpl::Receiving() const return _receiving; } -WebRtc_Word32 UdpTransportImpl::StopReceiving() +int32_t UdpTransportImpl::StopReceiving() { CriticalSectionScoped cs(_crit); @@ -1624,10 +1622,10 @@ WebRtc_Word32 UdpTransportImpl::StopReceiving() return 0; } -WebRtc_Word32 UdpTransportImpl::InitializeSendSockets( +int32_t UdpTransportImpl::InitializeSendSockets( const char* ipaddr, - const WebRtc_UWord16 rtpPort, - const WebRtc_UWord16 rtcpPort) + const uint16_t rtpPort, + const uint16_t rtcpPort) { { CriticalSectionScoped cs(_crit); @@ -1684,7 +1682,7 @@ WebRtc_Word32 UdpTransportImpl::InitializeSendSockets( // TODO (grunell): Multicast support is experimantal. // Put the first digit of the remote address in val. - WebRtc_Word32 val = ntohl(_remoteRTPAddr._sockaddr_in.sin_addr)>> 24; + int32_t val = ntohl(_remoteRTPAddr._sockaddr_in.sin_addr)>> 24; if((val > 223) && (val < 240)) { @@ -1707,10 +1705,10 @@ WebRtc_Word32 UdpTransportImpl::InitializeSendSockets( } // Set Time To Live to same region - WebRtc_Word32 iOptVal = 64; + int32_t iOptVal = 64; if (!rtpSock->SetSockopt(IPPROTO_IP, IP_MULTICAST_TTL, - (WebRtc_Word8*)&iOptVal, - sizeof (WebRtc_Word32))) + (int8_t*)&iOptVal, + sizeof (int32_t))) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "setsockopt for multicast error on RTP socket"); @@ -1720,8 +1718,8 @@ WebRtc_Word32 UdpTransportImpl::InitializeSendSockets( return -1; } if (!rtcpSock->SetSockopt(IPPROTO_IP, IP_MULTICAST_TTL, - (WebRtc_Word8*)&iOptVal, - sizeof (WebRtc_Word32))) + (int8_t*)&iOptVal, + sizeof (int32_t))) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "setsockopt for multicast error on RTCP socket"); @@ -1735,7 +1733,7 @@ WebRtc_Word32 UdpTransportImpl::InitializeSendSockets( return 0; } -void UdpTransportImpl::BuildSockaddrIn(WebRtc_UWord16 portnr, +void UdpTransportImpl::BuildSockaddrIn(uint16_t portnr, const char* ip, SocketAddress& remoteAddr) const { @@ -1766,11 +1764,11 @@ void UdpTransportImpl::BuildSockaddrIn(WebRtc_UWord16 portnr, } } -WebRtc_Word32 UdpTransportImpl::SendRaw(const WebRtc_Word8 *data, - WebRtc_UWord32 length, - WebRtc_Word32 isRTCP, - WebRtc_UWord16 portnr, - const char* ip) +int32_t UdpTransportImpl::SendRaw(const int8_t *data, + uint32_t length, + int32_t isRTCP, + uint16_t portnr, + const char* ip) { CriticalSectionScoped cs(_crit); if(isRTCP) @@ -1842,9 +1840,9 @@ WebRtc_Word32 UdpTransportImpl::SendRaw(const WebRtc_Word8 *data, } } -WebRtc_Word32 UdpTransportImpl::SendRTPPacketTo(const WebRtc_Word8* data, - WebRtc_UWord32 length, - const SocketAddress& to) +int32_t UdpTransportImpl::SendRTPPacketTo(const int8_t* data, + uint32_t length, + const SocketAddress& to) { CriticalSectionScoped cs(_crit); if(_ptrSendRtpSocket) @@ -1858,9 +1856,9 @@ WebRtc_Word32 UdpTransportImpl::SendRTPPacketTo(const WebRtc_Word8* data, return -1; } -WebRtc_Word32 UdpTransportImpl::SendRTCPPacketTo(const WebRtc_Word8* data, - WebRtc_UWord32 length, - const SocketAddress& to) +int32_t UdpTransportImpl::SendRTCPPacketTo(const int8_t* data, + uint32_t length, + const SocketAddress& to) { CriticalSectionScoped cs(_crit); @@ -1876,9 +1874,9 @@ WebRtc_Word32 UdpTransportImpl::SendRTCPPacketTo(const WebRtc_Word8* data, return -1; } -WebRtc_Word32 UdpTransportImpl::SendRTPPacketTo(const WebRtc_Word8* data, - WebRtc_UWord32 length, - const WebRtc_UWord16 rtpPort) +int32_t UdpTransportImpl::SendRTPPacketTo(const int8_t* data, + uint32_t length, + const uint16_t rtpPort) { CriticalSectionScoped cs(_crit); // Use the current SocketAdress but update it with rtpPort. @@ -1904,9 +1902,9 @@ WebRtc_Word32 UdpTransportImpl::SendRTPPacketTo(const WebRtc_Word8* data, return -1; } -WebRtc_Word32 UdpTransportImpl::SendRTCPPacketTo(const WebRtc_Word8* data, - WebRtc_UWord32 length, - const WebRtc_UWord16 rtcpPort) +int32_t UdpTransportImpl::SendRTCPPacketTo(const int8_t* data, + uint32_t length, + const uint16_t rtcpPort) { CriticalSectionScoped cs(_crit); @@ -1989,12 +1987,12 @@ int UdpTransportImpl::SendPacket(int /*channel*/, const void* data, int length) if(_ptrSendRtpSocket) { - return _ptrSendRtpSocket->SendTo((const WebRtc_Word8*)data, length, + return _ptrSendRtpSocket->SendTo((const int8_t*)data, length, _remoteRTPAddr); } else if(_ptrRtpSocket) { - return _ptrRtpSocket->SendTo((const WebRtc_Word8*)data, length, + return _ptrRtpSocket->SendTo((const int8_t*)data, length, _remoteRTPAddr); } return -1; @@ -2055,17 +2053,17 @@ int UdpTransportImpl::SendRTCPPacket(int /*channel*/, const void* data, if(_ptrSendRtcpSocket) { - return _ptrSendRtcpSocket->SendTo((const WebRtc_Word8*)data, length, + return _ptrSendRtcpSocket->SendTo((const int8_t*)data, length, _remoteRTCPAddr); } else if(_ptrRtcpSocket) { - return _ptrRtcpSocket->SendTo((const WebRtc_Word8*)data, length, + return _ptrRtcpSocket->SendTo((const int8_t*)data, length, _remoteRTCPAddr); } return -1; } -WebRtc_Word32 UdpTransportImpl::SetSendIP(const char* ipaddr) +int32_t UdpTransportImpl::SetSendIP(const char* ipaddr) { if(!IsIpAddressValid(ipaddr,IpV6Enabled())) { @@ -2078,8 +2076,7 @@ WebRtc_Word32 UdpTransportImpl::SetSendIP(const char* ipaddr) return 0; } -WebRtc_Word32 UdpTransportImpl::SetSendPorts(WebRtc_UWord16 rtpPort, - WebRtc_UWord16 rtcpPort) +int32_t UdpTransportImpl::SetSendPorts(uint16_t rtpPort, uint16_t rtcpPort) { CriticalSectionScoped cs(_crit); _destPort = rtpPort; @@ -2096,8 +2093,8 @@ WebRtc_Word32 UdpTransportImpl::SetSendPorts(WebRtc_UWord16 rtpPort, } void UdpTransportImpl::IncomingRTPCallback(CallbackObj obj, - const WebRtc_Word8* rtpPacket, - WebRtc_Word32 rtpPacketLength, + const int8_t* rtpPacket, + int32_t rtpPacketLength, const SocketAddress* from) { if (rtpPacket && rtpPacketLength > 0) @@ -2108,8 +2105,8 @@ void UdpTransportImpl::IncomingRTPCallback(CallbackObj obj, } void UdpTransportImpl::IncomingRTCPCallback(CallbackObj obj, - const WebRtc_Word8* rtcpPacket, - WebRtc_Word32 rtcpPacketLength, + const int8_t* rtcpPacket, + int32_t rtcpPacketLength, const SocketAddress* from) { if (rtcpPacket && rtcpPacketLength > 0) @@ -2120,13 +2117,13 @@ void UdpTransportImpl::IncomingRTCPCallback(CallbackObj obj, } } -void UdpTransportImpl::IncomingRTPFunction(const WebRtc_Word8* rtpPacket, - WebRtc_Word32 rtpPacketLength, +void UdpTransportImpl::IncomingRTPFunction(const int8_t* rtpPacket, + int32_t rtpPacketLength, const SocketAddress* fromSocket) { char ipAddress[kIpAddressVersion6Length]; - WebRtc_UWord32 ipAddressLength = kIpAddressVersion6Length; - WebRtc_UWord16 portNr = 0; + uint32_t ipAddressLength = kIpAddressVersion6Length; + uint16_t portNr = 0; { CriticalSectionScoped cs(_critFilter); @@ -2183,13 +2180,13 @@ void UdpTransportImpl::IncomingRTPFunction(const WebRtc_Word8* rtpPacket, } } -void UdpTransportImpl::IncomingRTCPFunction(const WebRtc_Word8* rtcpPacket, - WebRtc_Word32 rtcpPacketLength, +void UdpTransportImpl::IncomingRTCPFunction(const int8_t* rtcpPacket, + int32_t rtcpPacketLength, const SocketAddress* fromSocket) { char ipAddress[kIpAddressVersion6Length]; - WebRtc_UWord32 ipAddressLength = kIpAddressVersion6Length; - WebRtc_UWord16 portNr = 0; + uint32_t ipAddressLength = kIpAddressVersion6Length; + uint16_t portNr = 0; { CriticalSectionScoped cs(_critFilter); @@ -2263,7 +2260,7 @@ bool UdpTransportImpl::FilterIPAddress(const SocketAddress* fromAddress) if (_filterIPAddress._sockaddr_storage.sin_family == AF_INET6) { // IP is stored in sin_6addr. - for (WebRtc_Word32 i = 0; i < 4; i++) + for (int32_t i = 0; i < 4; i++) { if (_filterIPAddress._sockaddr_in6.sin6_addr.Version6AddressUnion._s6_u32[i] != 0 && _filterIPAddress._sockaddr_in6.sin6_addr.Version6AddressUnion._s6_u32[i] != fromAddress->_sockaddr_in6.sin6_addr.Version6AddressUnion._s6_u32[i]) @@ -2314,27 +2311,27 @@ void UdpTransportImpl::CloseSendSockets() } } -WebRtc_UWord16 UdpTransport::Htons(const WebRtc_UWord16 port) +uint16_t UdpTransport::Htons(const uint16_t port) { return htons(port); } -WebRtc_UWord32 UdpTransport::Htonl(const WebRtc_UWord32 a) +uint32_t UdpTransport::Htonl(const uint32_t a) { return htonl(a); } -WebRtc_UWord32 UdpTransport::InetAddrIPV4(const char* ip) +uint32_t UdpTransport::InetAddrIPV4(const char* ip) { return ::inet_addr(ip); } -WebRtc_Word32 UdpTransport::InetPresentationToNumeric(WebRtc_Word32 af, - const char* src, - void* dst) +int32_t UdpTransport::InetPresentationToNumeric(int32_t af, + const char* src, + void* dst) { #if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) - const WebRtc_Word32 result = inet_pton(af, src, dst); + const int32_t result = inet_pton(af, src, dst); return result > 0 ? 0 : -1; #elif defined(_WIN32) @@ -2343,7 +2340,7 @@ WebRtc_Word32 UdpTransport::InetPresentationToNumeric(WebRtc_Word32 af, if(af == AF_INET) { - WebRtc_Word32 result = WSAStringToAddressA( + int32_t result = WSAStringToAddressA( (const LPSTR)src, af, 0, @@ -2359,7 +2356,7 @@ WebRtc_Word32 UdpTransport::InetPresentationToNumeric(WebRtc_Word32 af, } else if(af == AF_INET6) { - WebRtc_Word32 result = WSAStringToAddressA( + int32_t result = WSAStringToAddressA( (const LPSTR)src, af, 0, @@ -2382,7 +2379,7 @@ WebRtc_Word32 UdpTransport::InetPresentationToNumeric(WebRtc_Word32 af, #endif } -WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16]) +int32_t UdpTransport::LocalHostAddressIPV6(char n_localIP[16]) { #if defined(_WIN32) @@ -2620,7 +2617,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16]) #endif } -WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP) +int32_t UdpTransport::LocalHostAddress(uint32_t& localIP) { #if defined(_WIN32) hostent* localHost; @@ -2642,7 +2639,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP) } else { - WebRtc_Word32 error = WSAGetLastError(); + int32_t error = WSAGetLastError(); WEBRTC_TRACE(kTraceWarning, kTraceTransport, -1, "gethostbyname failed, error:%d", error); return -1; @@ -2730,14 +2727,14 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP) #endif } -WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address, - char* ip, - WebRtc_UWord32& ipSize, - WebRtc_UWord16& sourcePort) +int32_t UdpTransport::IPAddress(const SocketAddress& address, + char* ip, + uint32_t& ipSize, + uint16_t& sourcePort) { #if defined(_WIN32) DWORD dwIPSize = ipSize; - WebRtc_Word32 returnvalue = WSAAddressToStringA((LPSOCKADDR)(&address), + int32_t returnvalue = WSAAddressToStringA((LPSOCKADDR)(&address), sizeof(SocketAddress), NULL, ip, @@ -2747,7 +2744,7 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address, return -1; } - WebRtc_UWord16 source_port = 0; + uint16_t source_port = 0; if(address._sockaddr_storage.sin_family == AF_INET) { // Parse IP assuming format "a.b.c.d:port". @@ -2756,7 +2753,7 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address, { *ipEnd = '\0'; } - ipSize = (WebRtc_Word32)strlen(ip); + ipSize = (int32_t)strlen(ip); if(ipSize == 0) { return -1; @@ -2770,11 +2767,11 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address, if(ipEnd != NULL) { // Calculate length - WebRtc_Word32 adrSize = WebRtc_Word32(ipEnd - ip) - 1; + int32_t adrSize = int32_t(ipEnd - ip) - 1; memmove(ip, &ip[1], adrSize); // Remove '[' *(ipEnd - 1) = '\0'; } - ipSize = (WebRtc_Word32)strlen(ip); + ipSize = (int32_t)strlen(ip); if(ipSize == 0) { return -1; @@ -2787,7 +2784,7 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address, return 0; #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) - WebRtc_Word32 ipFamily = address._sockaddr_storage.sin_family; + int32_t ipFamily = address._sockaddr_storage.sin_family; const void* ptrNumericIP = NULL; if(ipFamily == AF_INET) @@ -2806,7 +2803,7 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address, { return -1; } - WebRtc_UWord16 source_port; + uint16_t source_port; if(ipFamily == AF_INET) { source_port = address._sockaddr_in.sin_port; @@ -2826,19 +2823,19 @@ bool UdpTransport::IsIpAddressValid(const char* ipadr, const bool ipV6) { if(ipV6) { - WebRtc_Word32 len = (WebRtc_Word32)strlen(ipadr); + int32_t len = (int32_t)strlen(ipadr); if( len>39 || len == 0) { return false; } - WebRtc_Word32 i; - WebRtc_Word32 colonPos[7] = {0,0,0,0,0,0,0}; - WebRtc_Word32 lastColonPos = -2; - WebRtc_Word32 nColons = 0; - WebRtc_Word32 nDubbleColons = 0; - WebRtc_Word32 nDots = 0; - WebRtc_Word32 error = 0; + int32_t i; + int32_t colonPos[7] = {0,0,0,0,0,0,0}; + int32_t lastColonPos = -2; + int32_t nColons = 0; + int32_t nDubbleColons = 0; + int32_t nDots = 0; + int32_t error = 0; char c; for(i = 0; i < len ; i++) { @@ -2885,7 +2882,7 @@ bool UdpTransport::IsIpAddressValid(const char* ipadr, const bool ipV6) return false; } lastColonPos = -1; - WebRtc_Word32 charsBeforeColon = 0; + int32_t charsBeforeColon = 0; for(i = 0; i < nColons; i++) { charsBeforeColon=colonPos[i]-lastColonPos-1; @@ -2895,7 +2892,7 @@ bool UdpTransport::IsIpAddressValid(const char* ipadr, const bool ipV6) } lastColonPos=colonPos[i]; } - WebRtc_Word32 lengthAfterLastColon = len - lastColonPos - 1; + int32_t lengthAfterLastColon = len - lastColonPos - 1; if(nDots == 0) { if(lengthAfterLastColon > 4) @@ -2909,16 +2906,16 @@ bool UdpTransport::IsIpAddressValid(const char* ipadr, const bool ipV6) } else { - WebRtc_Word32 len = (WebRtc_Word32)strlen(ipadr); + int32_t len = (int32_t)strlen(ipadr); if((len>15)||(len==0)) { return false; } // IPv4 should be [0-255].[0-255].[0-255].[0-255] - WebRtc_Word32 i; - WebRtc_Word32 nDots = 0; - WebRtc_Word32 iDotPos[4] = {0,0,0,0}; + int32_t i; + int32_t nDots = 0; + int32_t iDotPos[4] = {0,0,0,0}; for (i = 0; (i < len) && (nDots < 4); i++) { @@ -2946,7 +2943,7 @@ bool UdpTransport::IsIpAddressValid(const char* ipadr, const bool ipV6) char nr[4]; memset(nr,0,4); strncpy(nr,&ipadr[0],iDotPos[0]); - WebRtc_Word32 num = atoi(nr); + int32_t num = atoi(nr); if (num > 255) { break; @@ -2960,7 +2957,7 @@ bool UdpTransport::IsIpAddressValid(const char* ipadr, const bool ipV6) char nr[4]; memset(nr,0,4); strncpy(nr,&ipadr[iDotPos[0]+1], iDotPos[1] - iDotPos[0] - 1); - WebRtc_Word32 num = atoi(nr); + int32_t num = atoi(nr); if (num > 255) break; } else { @@ -2972,7 +2969,7 @@ bool UdpTransport::IsIpAddressValid(const char* ipadr, const bool ipV6) char nr[4]; memset(nr,0,4); strncpy(nr,&ipadr[iDotPos[1]+1], iDotPos[1] - iDotPos[0] - 1); - WebRtc_Word32 num = atoi(nr); + int32_t num = atoi(nr); if (num > 255) break; diff --git a/webrtc/test/channel_transport/udp_transport_impl.h b/webrtc/test/channel_transport/udp_transport_impl.h index 644b71650..e60416130 100644 --- a/webrtc/test/channel_transport/udp_transport_impl.h +++ b/webrtc/test/channel_transport/udp_transport_impl.h @@ -30,7 +30,7 @@ public: class SocketFactoryInterface { public: virtual ~SocketFactoryInterface() {} - virtual UdpSocketWrapper* CreateSocket(const WebRtc_Word32 id, + virtual UdpSocketWrapper* CreateSocket(const int32_t id, UdpSocketManager* mgr, CallbackObj obj, IncomingSocketCallback cb, @@ -41,113 +41,111 @@ public: // Constructor, only called by UdpTransport::Create and tests. // The constructor takes ownership of the "maker". // The constructor does not take ownership of socket_manager. - UdpTransportImpl(const WebRtc_Word32 id, + UdpTransportImpl(const int32_t id, SocketFactoryInterface* maker, UdpSocketManager* socket_manager); virtual ~UdpTransportImpl(); // UdpTransport functions - virtual WebRtc_Word32 InitializeSendSockets( + virtual int32_t InitializeSendSockets( const char* ipAddr, - const WebRtc_UWord16 rtpPort, - const WebRtc_UWord16 rtcpPort = 0); - virtual WebRtc_Word32 InitializeReceiveSockets( + const uint16_t rtpPort, + const uint16_t rtcpPort = 0); + virtual int32_t InitializeReceiveSockets( UdpTransportData* const packetCallback, - const WebRtc_UWord16 rtpPort, + const uint16_t rtpPort, const char* ipAddr = NULL, const char* multicastIpAddr = NULL, - const WebRtc_UWord16 rtcpPort = 0); - virtual WebRtc_Word32 InitializeSourcePorts( - const WebRtc_UWord16 rtpPort, - const WebRtc_UWord16 rtcpPort = 0); - virtual WebRtc_Word32 SourcePorts(WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort) const; - virtual WebRtc_Word32 ReceiveSocketInformation( + const uint16_t rtcpPort = 0); + virtual int32_t InitializeSourcePorts( + const uint16_t rtpPort, + const uint16_t rtcpPort = 0); + virtual int32_t SourcePorts(uint16_t& rtpPort, uint16_t& rtcpPort) const; + virtual int32_t ReceiveSocketInformation( char ipAddr[kIpAddressVersion6Length], - WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort, + uint16_t& rtpPort, + uint16_t& rtcpPort, char multicastIpAddr[kIpAddressVersion6Length]) const; - virtual WebRtc_Word32 SendSocketInformation( + virtual int32_t SendSocketInformation( char ipAddr[kIpAddressVersion6Length], - WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort) const; - virtual WebRtc_Word32 RemoteSocketInformation( + uint16_t& rtpPort, + uint16_t& rtcpPort) const; + virtual int32_t RemoteSocketInformation( char ipAddr[kIpAddressVersion6Length], - WebRtc_UWord16& rtpPort, - WebRtc_UWord16& rtcpPort) const; - virtual WebRtc_Word32 SetQoS(const bool QoS, - const WebRtc_Word32 serviceType, - const WebRtc_UWord32 maxBitrate = 0, - const WebRtc_Word32 overrideDSCP = 0, - const bool audio = false); - virtual WebRtc_Word32 QoS(bool& QoS, WebRtc_Word32& serviceType, - WebRtc_Word32& overrideDSCP) const; - virtual WebRtc_Word32 SetToS(const WebRtc_Word32 DSCP, - const bool useSetSockOpt = false); - virtual WebRtc_Word32 ToS(WebRtc_Word32& DSCP, - bool& useSetSockOpt) const; - virtual WebRtc_Word32 SetPCP(const WebRtc_Word32 PCP); - virtual WebRtc_Word32 PCP(WebRtc_Word32& PCP) const; - virtual WebRtc_Word32 EnableIpV6(); + uint16_t& rtpPort, + uint16_t& rtcpPort) const; + virtual int32_t SetQoS(const bool QoS, + const int32_t serviceType, + const uint32_t maxBitrate = 0, + const int32_t overrideDSCP = 0, + const bool audio = false); + virtual int32_t QoS(bool& QoS, int32_t& serviceType, + int32_t& overrideDSCP) const; + virtual int32_t SetToS(const int32_t DSCP, + const bool useSetSockOpt = false); + virtual int32_t ToS(int32_t& DSCP, bool& useSetSockOpt) const; + virtual int32_t SetPCP(const int32_t PCP); + virtual int32_t PCP(int32_t& PCP) const; + virtual int32_t EnableIpV6(); virtual bool IpV6Enabled() const; - virtual WebRtc_Word32 SetFilterIP( + virtual int32_t SetFilterIP( const char filterIPAddress[kIpAddressVersion6Length]); - virtual WebRtc_Word32 FilterIP( + virtual int32_t FilterIP( char filterIPAddress[kIpAddressVersion6Length]) const; - virtual WebRtc_Word32 SetFilterPorts(const WebRtc_UWord16 rtpFilterPort, - const WebRtc_UWord16 rtcpFilterPort); - virtual WebRtc_Word32 FilterPorts(WebRtc_UWord16& rtpFilterPort, - WebRtc_UWord16& rtcpFilterPort) const; - virtual WebRtc_Word32 StartReceiving( - const WebRtc_UWord32 numberOfSocketBuffers); - virtual WebRtc_Word32 StopReceiving(); + virtual int32_t SetFilterPorts(const uint16_t rtpFilterPort, + const uint16_t rtcpFilterPort); + virtual int32_t FilterPorts(uint16_t& rtpFilterPort, + uint16_t& rtcpFilterPort) const; + virtual int32_t StartReceiving( + const uint32_t numberOfSocketBuffers); + virtual int32_t StopReceiving(); virtual bool Receiving() const; virtual bool SendSocketsInitialized() const; virtual bool SourcePortsInitialized() const; virtual bool ReceiveSocketsInitialized() const; - virtual WebRtc_Word32 SendRaw(const WebRtc_Word8* data, - WebRtc_UWord32 length, WebRtc_Word32 isRTCP, - WebRtc_UWord16 portnr = 0, - const char* ip = NULL); - virtual WebRtc_Word32 SendRTPPacketTo(const WebRtc_Word8 *data, - WebRtc_UWord32 length, - const SocketAddress& to); - virtual WebRtc_Word32 SendRTCPPacketTo(const WebRtc_Word8 *data, - WebRtc_UWord32 length, - const SocketAddress& to); - virtual WebRtc_Word32 SendRTPPacketTo(const WebRtc_Word8 *data, - WebRtc_UWord32 length, - WebRtc_UWord16 rtpPort); - virtual WebRtc_Word32 SendRTCPPacketTo(const WebRtc_Word8 *data, - WebRtc_UWord32 length, - WebRtc_UWord16 rtcpPort); + virtual int32_t SendRaw(const int8_t* data, + uint32_t length, int32_t isRTCP, + uint16_t portnr = 0, + const char* ip = NULL); + virtual int32_t SendRTPPacketTo(const int8_t *data, + uint32_t length, + const SocketAddress& to); + virtual int32_t SendRTCPPacketTo(const int8_t *data, + uint32_t length, + const SocketAddress& to); + virtual int32_t SendRTPPacketTo(const int8_t *data, + uint32_t length, + uint16_t rtpPort); + virtual int32_t SendRTCPPacketTo(const int8_t *data, + uint32_t length, + uint16_t rtcpPort); // Transport functions virtual int SendPacket(int channel, const void* data, int length); virtual int SendRTCPPacket(int channel, const void* data, int length); // UdpTransport functions continue. - virtual WebRtc_Word32 SetSendIP(const char* ipaddr); - virtual WebRtc_Word32 SetSendPorts(const WebRtc_UWord16 rtpPort, - const WebRtc_UWord16 rtcpPort = 0); + virtual int32_t SetSendIP(const char* ipaddr); + virtual int32_t SetSendPorts(const uint16_t rtpPort, + const uint16_t rtcpPort = 0); virtual ErrorCode LastError() const; - virtual WebRtc_Word32 IPAddressCached(const SocketAddress& address, - char* ip, - WebRtc_UWord32& ipSize, - WebRtc_UWord16& sourcePort); + virtual int32_t IPAddressCached(const SocketAddress& address, + char* ip, + uint32_t& ipSize, + uint16_t& sourcePort); - WebRtc_Word32 Id() const {return _id;} + int32_t Id() const {return _id;} protected: // IncomingSocketCallback signature functions for receiving callbacks from // UdpSocketWrapper. static void IncomingRTPCallback(CallbackObj obj, - const WebRtc_Word8* rtpPacket, - WebRtc_Word32 rtpPacketLength, + const int8_t* rtpPacket, + int32_t rtpPacketLength, const SocketAddress* from); static void IncomingRTCPCallback(CallbackObj obj, - const WebRtc_Word8* rtcpPacket, - WebRtc_Word32 rtcpPacketLength, + const int8_t* rtcpPacket, + int32_t rtcpPacketLength, const SocketAddress* from); void CloseSendSockets(); @@ -158,7 +156,7 @@ protected: // Update _remoteRTCPAddr according to _destPortRTCP and _destIP void BuildRemoteRTCPAddr(); - void BuildSockaddrIn(WebRtc_UWord16 portnr, const char* ip, + void BuildSockaddrIn(uint16_t portnr, const char* ip, SocketAddress& remoteAddr) const; ErrorCode BindLocalRTPSocket(); @@ -167,28 +165,27 @@ protected: ErrorCode BindRTPSendSocket(); ErrorCode BindRTCPSendSocket(); - void IncomingRTPFunction(const WebRtc_Word8* rtpPacket, - WebRtc_Word32 rtpPacketLength, + void IncomingRTPFunction(const int8_t* rtpPacket, + int32_t rtpPacketLength, const SocketAddress* from); - void IncomingRTCPFunction(const WebRtc_Word8* rtcpPacket, - WebRtc_Word32 rtcpPacketLength, + void IncomingRTCPFunction(const int8_t* rtcpPacket, + int32_t rtcpPacketLength, const SocketAddress* from); bool FilterIPAddress(const SocketAddress* fromAddress); bool SetSockOptUsed(); - WebRtc_Word32 EnableQoS(WebRtc_Word32 serviceType, bool audio, - WebRtc_UWord32 maxBitrate, - WebRtc_Word32 overrideDSCP); + int32_t EnableQoS(int32_t serviceType, bool audio, + uint32_t maxBitrate, int32_t overrideDSCP); - WebRtc_Word32 DisableQoS(); + int32_t DisableQoS(); private: - void GetCachedAddress(char* ip, WebRtc_UWord32& ipSize, - WebRtc_UWord16& sourcePort); + void GetCachedAddress(char* ip, uint32_t& ipSize, + uint16_t& sourcePort); - WebRtc_Word32 _id; + int32_t _id; SocketFactoryInterface* _socket_creator; // Protects the sockets from being re-configured while receiving packets. CriticalSectionWrapper* _crit; @@ -199,21 +196,21 @@ private: ErrorCode _lastError; // Remote RTP and RTCP ports. - WebRtc_UWord16 _destPort; - WebRtc_UWord16 _destPortRTCP; + uint16_t _destPort; + uint16_t _destPortRTCP; // Local RTP and RTCP ports. - WebRtc_UWord16 _localPort; - WebRtc_UWord16 _localPortRTCP; + uint16_t _localPort; + uint16_t _localPortRTCP; // Local port number when the local port for receiving and local port number // for sending are not the same. - WebRtc_UWord16 _srcPort; - WebRtc_UWord16 _srcPortRTCP; + uint16_t _srcPort; + uint16_t _srcPortRTCP; // Remote port from which last received packet was sent. - WebRtc_UWord16 _fromPort; - WebRtc_UWord16 _fromPortRTCP; + uint16_t _fromPort; + uint16_t _fromPortRTCP; char _fromIP[kIpAddressVersion6Length]; char _destIP[kIpAddressVersion6Length]; @@ -234,26 +231,26 @@ private: SocketAddress _localRTPAddr; SocketAddress _localRTCPAddr; - WebRtc_Word32 _tos; + int32_t _tos; bool _receiving; bool _useSetSockOpt; bool _qos; - WebRtc_Word32 _pcp; + int32_t _pcp; bool _ipV6Enabled; - WebRtc_Word32 _serviceType; - WebRtc_Word32 _overrideDSCP; - WebRtc_UWord32 _maxBitrate; + int32_t _serviceType; + int32_t _overrideDSCP; + uint32_t _maxBitrate; // Cache used by GetCachedAddress(..). RWLockWrapper* _cachLock; SocketAddress _previousAddress; char _previousIP[kIpAddressVersion6Length]; - WebRtc_UWord32 _previousIPSize; - WebRtc_UWord16 _previousSourcePort; + uint32_t _previousIPSize; + uint16_t _previousSourcePort; SocketAddress _filterIPAddress; - WebRtc_UWord16 _rtpFilterPort; - WebRtc_UWord16 _rtcpFilterPort; + uint16_t _rtpFilterPort; + uint16_t _rtcpFilterPort; UdpTransportData* _packetCallback; }; diff --git a/webrtc/test/channel_transport/udp_transport_unittest.cc b/webrtc/test/channel_transport/udp_transport_unittest.cc index 7408e4b81..d1bbb1dfc 100644 --- a/webrtc/test/channel_transport/udp_transport_unittest.cc +++ b/webrtc/test/channel_transport/udp_transport_unittest.cc @@ -28,21 +28,20 @@ namespace test { class MockUdpSocketWrapper : public UdpSocketWrapper { public: // The following methods have to be mocked because they are pure. - MOCK_METHOD1(ChangeUniqueId, WebRtc_Word32(WebRtc_Word32)); + MOCK_METHOD1(ChangeUniqueId, int32_t(int32_t)); MOCK_METHOD2(SetCallback, bool(CallbackObj, IncomingSocketCallback)); MOCK_METHOD1(Bind, bool(const SocketAddress&)); MOCK_METHOD0(ValidHandle, bool()); - MOCK_METHOD4(SetSockopt, bool(WebRtc_Word32, WebRtc_Word32, - const WebRtc_Word8*, - WebRtc_Word32)); - MOCK_METHOD1(SetTOS, WebRtc_Word32(WebRtc_Word32)); - MOCK_METHOD3(SendTo, WebRtc_Word32(const WebRtc_Word8*, WebRtc_Word32, - const SocketAddress&)); - MOCK_METHOD8(SetQos, bool(WebRtc_Word32, WebRtc_Word32, - WebRtc_Word32, WebRtc_Word32, - WebRtc_Word32, WebRtc_Word32, + MOCK_METHOD4(SetSockopt, bool(int32_t, int32_t, + const int8_t*, + int32_t)); + MOCK_METHOD1(SetTOS, int32_t(int32_t)); + MOCK_METHOD3(SendTo, int32_t(const int8_t*, int32_t, const SocketAddress&)); + MOCK_METHOD8(SetQos, bool(int32_t, int32_t, + int32_t, int32_t, + int32_t, int32_t, const SocketAddress &, - WebRtc_Word32)); + int32_t)); }; class MockUdpSocketManager : public UdpSocketManager { @@ -51,8 +50,8 @@ class MockUdpSocketManager : public UdpSocketManager { void Destroy() { delete this; } - MOCK_METHOD2(Init, bool(WebRtc_Word32, WebRtc_UWord8&)); - MOCK_METHOD1(ChangeUniqueId, WebRtc_Word32(const WebRtc_Word32)); + MOCK_METHOD2(Init, bool(int32_t, uint8_t&)); + MOCK_METHOD1(ChangeUniqueId, int32_t(const int32_t)); MOCK_METHOD0(Start, bool()); MOCK_METHOD0(Stop, bool()); MOCK_METHOD1(AddSocket, bool(UdpSocketWrapper*)); @@ -65,7 +64,7 @@ class MockSocketFactory : MockSocketFactory(std::vector* socket_counter) : socket_counter_(socket_counter) { } - UdpSocketWrapper* CreateSocket(const WebRtc_Word32 id, + UdpSocketWrapper* CreateSocket(const int32_t id, UdpSocketManager* mgr, CallbackObj obj, IncomingSocketCallback cb, @@ -110,15 +109,15 @@ private: }; TEST_F(UDPTransportTest, CreateTransport) { - WebRtc_Word32 id = 0; - WebRtc_UWord8 threads = 1; + int32_t id = 0; + uint8_t threads = 1; UdpTransport* transport = UdpTransport::Create(id, threads); UdpTransport::Destroy(transport); } // This test verifies that the mock_socket is not called from the constructor. TEST_F(UDPTransportTest, ConstructorDoesNotCreateSocket) { - WebRtc_Word32 id = 0; + int32_t id = 0; UdpTransportImpl::SocketFactoryInterface* null_maker = NULL; UdpSocketManager* null_manager = NULL; UdpTransport* transport = new UdpTransportImpl(id, @@ -128,7 +127,7 @@ TEST_F(UDPTransportTest, ConstructorDoesNotCreateSocket) { } TEST_F(UDPTransportTest, InitializeSourcePorts) { - WebRtc_Word32 id = 0; + int32_t id = 0; UdpTransportImpl::SocketFactoryInterface* mock_maker = new MockSocketFactory(sockets_created()); MockUdpSocketManager* mock_manager = new MockUdpSocketManager(); diff --git a/webrtc/test/testsupport/frame_reader.cc b/webrtc/test/testsupport/frame_reader.cc index 1736b8a63..273312230 100644 --- a/webrtc/test/testsupport/frame_reader.cc +++ b/webrtc/test/testsupport/frame_reader.cc @@ -58,7 +58,7 @@ void FrameReaderImpl::Close() { } } -bool FrameReaderImpl::ReadFrame(WebRtc_UWord8* source_buffer) { +bool FrameReaderImpl::ReadFrame(uint8_t* source_buffer) { assert(source_buffer); if (input_file_ == NULL) { fprintf(stderr, "FrameReader is not initialized (input file is NULL)\n"); diff --git a/webrtc/test/testsupport/frame_reader.h b/webrtc/test/testsupport/frame_reader.h index 4413df9a7..78cf8d6e5 100644 --- a/webrtc/test/testsupport/frame_reader.h +++ b/webrtc/test/testsupport/frame_reader.h @@ -33,7 +33,7 @@ class FrameReader { // for the frame size. // Returns true if there are more frames to read, false if we've already // read the last frame (in the previous call). - virtual bool ReadFrame(WebRtc_UWord8* source_buffer) = 0; + virtual bool ReadFrame(uint8_t* source_buffer) = 0; // Closes the input file if open. Essentially makes this class impossible // to use anymore. Will also be invoked by the destructor. @@ -55,7 +55,7 @@ class FrameReaderImpl : public FrameReader { FrameReaderImpl(std::string input_filename, size_t frame_length_in_bytes); virtual ~FrameReaderImpl(); bool Init(); - bool ReadFrame(WebRtc_UWord8* source_buffer); + bool ReadFrame(uint8_t* source_buffer); void Close(); size_t FrameLength() { return frame_length_in_bytes_; } int NumberOfFrames() { return number_of_frames_; } diff --git a/webrtc/test/testsupport/frame_reader_unittest.cc b/webrtc/test/testsupport/frame_reader_unittest.cc index dadeaff6c..dbc1bc51a 100644 --- a/webrtc/test/testsupport/frame_reader_unittest.cc +++ b/webrtc/test/testsupport/frame_reader_unittest.cc @@ -54,7 +54,7 @@ TEST_F(FrameReaderTest, InitSuccess) { } TEST_F(FrameReaderTest, ReadFrame) { - WebRtc_UWord8 buffer[3]; + uint8_t buffer[3]; bool result = frame_reader_->ReadFrame(buffer); ASSERT_FALSE(result); // No more files to read. ASSERT_EQ(kInputFileContents[0], buffer[0]); @@ -63,7 +63,7 @@ TEST_F(FrameReaderTest, ReadFrame) { } TEST_F(FrameReaderTest, ReadFrameUninitialized) { - WebRtc_UWord8 buffer[3]; + uint8_t buffer[3]; FrameReaderImpl file_reader(kInputFilename, kFrameLength); ASSERT_FALSE(file_reader.ReadFrame(buffer)); } diff --git a/webrtc/test/testsupport/frame_writer.cc b/webrtc/test/testsupport/frame_writer.cc index d0b0b76f8..0eb6f4dc3 100644 --- a/webrtc/test/testsupport/frame_writer.cc +++ b/webrtc/test/testsupport/frame_writer.cc @@ -48,7 +48,7 @@ void FrameWriterImpl::Close() { } } -bool FrameWriterImpl::WriteFrame(WebRtc_UWord8* frame_buffer) { +bool FrameWriterImpl::WriteFrame(uint8_t* frame_buffer) { assert(frame_buffer); if (output_file_ == NULL) { fprintf(stderr, "FrameWriter is not initialized (output file is NULL)\n"); diff --git a/webrtc/test/testsupport/frame_writer.h b/webrtc/test/testsupport/frame_writer.h index 7b802f238..e10ef1911 100644 --- a/webrtc/test/testsupport/frame_writer.h +++ b/webrtc/test/testsupport/frame_writer.h @@ -31,7 +31,7 @@ class FrameWriter { // Writes a frame of the configured frame length to the output file. // Returns true if the write was successful, false otherwise. - virtual bool WriteFrame(WebRtc_UWord8* frame_buffer) = 0; + virtual bool WriteFrame(uint8_t* frame_buffer) = 0; // Closes the output file if open. Essentially makes this class impossible // to use anymore. Will also be invoked by the destructor. @@ -53,7 +53,7 @@ class FrameWriterImpl : public FrameWriter { FrameWriterImpl(std::string output_filename, size_t frame_length_in_bytes); virtual ~FrameWriterImpl(); bool Init(); - bool WriteFrame(WebRtc_UWord8* frame_buffer); + bool WriteFrame(uint8_t* frame_buffer); void Close(); size_t FrameLength() { return frame_length_in_bytes_; } diff --git a/webrtc/test/testsupport/frame_writer_unittest.cc b/webrtc/test/testsupport/frame_writer_unittest.cc index 52185dda4..109ae7d7c 100644 --- a/webrtc/test/testsupport/frame_writer_unittest.cc +++ b/webrtc/test/testsupport/frame_writer_unittest.cc @@ -44,7 +44,7 @@ TEST_F(FrameWriterTest, InitSuccess) { } TEST_F(FrameWriterTest, WriteFrame) { - WebRtc_UWord8 buffer[kFrameLength]; + uint8_t buffer[kFrameLength]; memset(buffer, 9, kFrameLength); // Write lots of 9s to the buffer bool result = frame_writer_->WriteFrame(buffer); ASSERT_TRUE(result); // success @@ -54,7 +54,7 @@ TEST_F(FrameWriterTest, WriteFrame) { } TEST_F(FrameWriterTest, WriteFrameUninitialized) { - WebRtc_UWord8 buffer[3]; + uint8_t buffer[3]; FrameWriterImpl frame_writer(kOutputFilename, kFrameLength); ASSERT_FALSE(frame_writer.WriteFrame(buffer)); } diff --git a/webrtc/test/testsupport/mock/mock_frame_reader.h b/webrtc/test/testsupport/mock/mock_frame_reader.h index f22dcd1a5..4ac5f4c9d 100644 --- a/webrtc/test/testsupport/mock/mock_frame_reader.h +++ b/webrtc/test/testsupport/mock/mock_frame_reader.h @@ -21,7 +21,7 @@ namespace test { class MockFrameReader : public FrameReader { public: MOCK_METHOD0(Init, bool()); - MOCK_METHOD1(ReadFrame, bool(WebRtc_UWord8* source_buffer)); + MOCK_METHOD1(ReadFrame, bool(uint8_t* source_buffer)); MOCK_METHOD0(Close, void()); MOCK_METHOD0(FrameLength, size_t()); MOCK_METHOD0(NumberOfFrames, int()); diff --git a/webrtc/test/testsupport/mock/mock_frame_writer.h b/webrtc/test/testsupport/mock/mock_frame_writer.h index 89650c959..7ac5b4950 100644 --- a/webrtc/test/testsupport/mock/mock_frame_writer.h +++ b/webrtc/test/testsupport/mock/mock_frame_writer.h @@ -21,7 +21,7 @@ namespace test { class MockFrameWriter : public FrameWriter { public: MOCK_METHOD0(Init, bool()); - MOCK_METHOD1(WriteFrame, bool(WebRtc_UWord8* frame_buffer)); + MOCK_METHOD1(WriteFrame, bool(uint8_t* frame_buffer)); MOCK_METHOD0(Close, void()); MOCK_METHOD0(FrameLength, size_t()); }; diff --git a/webrtc/test/testsupport/packet_reader.cc b/webrtc/test/testsupport/packet_reader.cc index e8859d106..619a7abd9 100644 --- a/webrtc/test/testsupport/packet_reader.cc +++ b/webrtc/test/testsupport/packet_reader.cc @@ -21,7 +21,7 @@ PacketReader::PacketReader() PacketReader::~PacketReader() {} -void PacketReader::InitializeReading(WebRtc_UWord8* data, +void PacketReader::InitializeReading(uint8_t* data, int data_length_in_bytes, int packet_size_in_bytes) { assert(data); @@ -34,7 +34,7 @@ void PacketReader::InitializeReading(WebRtc_UWord8* data, initialized_ = true; } -int PacketReader::NextPacket(WebRtc_UWord8** packet_pointer) { +int PacketReader::NextPacket(uint8_t** packet_pointer) { if (!initialized_) { fprintf(stderr, "Attempting to use uninitialized PacketReader!\n"); return -1; diff --git a/webrtc/test/testsupport/packet_reader.h b/webrtc/test/testsupport/packet_reader.h index 4cb0bb10e..e84ecd96b 100644 --- a/webrtc/test/testsupport/packet_reader.h +++ b/webrtc/test/testsupport/packet_reader.h @@ -11,7 +11,7 @@ #ifndef WEBRTC_TEST_TESTSUPPORT_PACKET_READER_H_ #define WEBRTC_TEST_TESTSUPPORT_PACKET_READER_H_ -#include "typedefs.h" +#include "webrtc/typedefs.h" namespace webrtc { namespace test { @@ -28,7 +28,7 @@ class PacketReader { // 0 length will result in no packets are read. // * packet_size_in_bytes is the number of bytes to read in each NextPacket // method call. Must be > 0 - virtual void InitializeReading(WebRtc_UWord8* data, int data_length_in_bytes, + virtual void InitializeReading(uint8_t* data, int data_length_in_bytes, int packet_size_in_bytes); // Moves the supplied pointer to the beginning of the next packet. @@ -37,10 +37,10 @@ class PacketReader { // the last packet) // * 0 if there are no more packets to read // * -1 if InitializeReading has not been called (also prints to stderr). - virtual int NextPacket(WebRtc_UWord8** packet_pointer); + virtual int NextPacket(uint8_t** packet_pointer); private: - WebRtc_UWord8* data_; + uint8_t* data_; int data_length_; int packet_size_; int currentIndex_; diff --git a/webrtc/test/testsupport/packet_reader_unittest.cc b/webrtc/test/testsupport/packet_reader_unittest.cc index 9c7fc3b13..1f3b20ac3 100644 --- a/webrtc/test/testsupport/packet_reader_unittest.cc +++ b/webrtc/test/testsupport/packet_reader_unittest.cc @@ -28,8 +28,8 @@ class PacketReaderTest: public PacketRelatedTest { } void VerifyPacketData(int expected_length, int actual_length, - WebRtc_UWord8* original_data_pointer, - WebRtc_UWord8* new_data_pointer) { + uint8_t* original_data_pointer, + uint8_t* new_data_pointer) { EXPECT_EQ(expected_length, actual_length); EXPECT_EQ(*original_data_pointer, *new_data_pointer); EXPECT_EQ(0, memcmp(original_data_pointer, new_data_pointer, @@ -40,7 +40,7 @@ class PacketReaderTest: public PacketRelatedTest { // Test lack of initialization TEST_F(PacketReaderTest, Uninitialized) { - WebRtc_UWord8* data_pointer = NULL; + uint8_t* data_pointer = NULL; EXPECT_EQ(-1, reader_->NextPacket(&data_pointer)); EXPECT_EQ(NULL, data_pointer); } @@ -53,8 +53,8 @@ TEST_F(PacketReaderTest, InitializeZeroLengthArgument) { // Test with something smaller than one packet TEST_F(PacketReaderTest, NormalSmallData) { const int kDataLengthInBytes = 1499; - WebRtc_UWord8 data[kDataLengthInBytes]; - WebRtc_UWord8* data_pointer = data; + uint8_t data[kDataLengthInBytes]; + uint8_t* data_pointer = data; memset(data, 1, kDataLengthInBytes); reader_->InitializeReading(data, kDataLengthInBytes, kPacketSizeInBytes); @@ -70,8 +70,8 @@ TEST_F(PacketReaderTest, NormalSmallData) { // Test with data length that exactly matches one packet TEST_F(PacketReaderTest, NormalOnePacketData) { - WebRtc_UWord8 data[kPacketSizeInBytes]; - WebRtc_UWord8* data_pointer = data; + uint8_t data[kPacketSizeInBytes]; + uint8_t* data_pointer = data; memset(data, 1, kPacketSizeInBytes); reader_->InitializeReading(data, kPacketSizeInBytes, kPacketSizeInBytes); @@ -112,8 +112,8 @@ TEST_F(PacketReaderTest, NormalLargeData) { TEST_F(PacketReaderTest, EmptyData) { const int kDataLengthInBytes = 0; // But don't really try to allocate a zero-length array... - WebRtc_UWord8 data[kPacketSizeInBytes]; - WebRtc_UWord8* data_pointer = data; + uint8_t data[kPacketSizeInBytes]; + uint8_t* data_pointer = data; reader_->InitializeReading(data, kDataLengthInBytes, kPacketSizeInBytes); EXPECT_EQ(kDataLengthInBytes, reader_->NextPacket(&data_pointer)); // Do it again to make sure nothing changes diff --git a/webrtc/test/testsupport/unittest_utils.h b/webrtc/test/testsupport/unittest_utils.h index 30464dead..bb244a441 100644 --- a/webrtc/test/testsupport/unittest_utils.h +++ b/webrtc/test/testsupport/unittest_utils.h @@ -26,12 +26,12 @@ const int kPacketDataNumberOfPackets = 3; class PacketRelatedTest: public testing::Test { protected: // Tree packet byte arrays with data used for verification: - WebRtc_UWord8 packet1_[kPacketSizeInBytes]; - WebRtc_UWord8 packet2_[kPacketSizeInBytes]; - WebRtc_UWord8 packet3_[1]; + uint8_t packet1_[kPacketSizeInBytes]; + uint8_t packet2_[kPacketSizeInBytes]; + uint8_t packet3_[1]; // Construct a data structure containing these packets - WebRtc_UWord8 packet_data_[kPacketDataLength]; - WebRtc_UWord8* packet_data_pointer_; + uint8_t packet_data_[kPacketDataLength]; + uint8_t* packet_data_pointer_; PacketRelatedTest() { packet_data_pointer_ = packet_data_;