Removed usage of the deprecated critical section constructor in udp_transport.

Review URL: http://webrtc-codereview.appspot.com/321005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1211 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrike@webrtc.org 2011-12-15 19:17:28 +00:00
parent 986fab1496
commit 7136990a3f
5 changed files with 44 additions and 44 deletions

View File

@ -100,7 +100,7 @@ UdpSocket2ManagerWindows::~UdpSocket2ManagerWindows()
bool UdpSocket2ManagerWindows::Init(WebRtc_Word32 id,
WebRtc_UWord8& numOfWorkThreads) {
CriticalSectionScoped cs(*_pCrit);
CriticalSectionScoped cs(_pCrit);
if ((_id != -1) || (_numOfWorkThreads != 0)) {
assert(_id != -1);
assert(_numOfWorkThreads != 0);

View File

@ -1318,7 +1318,7 @@ void UdpSocket2Windows::OutstandingCallCompleted()
{
// Only one thread will enter here. The thread with the last outstanding
// call.
CriticalSectionScoped cs(*_ptrDeleteCrit);
CriticalSectionScoped cs(_ptrDeleteCrit);
_safeTodelete = true;
_ptrDeleteCond->Wake();
}
@ -1341,7 +1341,7 @@ void UdpSocket2Windows::DisableNewOutstandingCalls()
if(noOutstandingCalls)
{
CriticalSectionScoped cs(*_ptrDeleteCrit);
CriticalSectionScoped cs(_ptrDeleteCrit);
_safeTodelete = true;
_ptrDeleteCond->Wake();
}
@ -1349,7 +1349,7 @@ void UdpSocket2Windows::DisableNewOutstandingCalls()
void UdpSocket2Windows::WaitForOutstandingCalls()
{
CriticalSectionScoped cs(*_ptrDeleteCrit);
CriticalSectionScoped cs(_ptrDeleteCrit);
while(!_safeTodelete)
{
_ptrDeleteCond->SleepCS(*_ptrDeleteCrit);

View File

@ -33,7 +33,7 @@ UdpSocketManagerPosix::UdpSocketManagerPosix()
bool UdpSocketManagerPosix::Init(WebRtc_Word32 id,
WebRtc_UWord8& numOfWorkThreads) {
CriticalSectionScoped cs(*_critSect);
CriticalSectionScoped cs(_critSect);
if ((_id != -1) || (_numOfWorkThreads != 0)) {
assert(_id != -1);
assert(_numOfWorkThreads != 0);

View File

@ -30,7 +30,7 @@ UdpSocketManagerWindows::UdpSocketManagerWindows()
bool UdpSocketManagerWindows::Init(WebRtc_Word32 id,
WebRtc_UWord8& numOfWorkThreads) {
CriticalSectionScoped cs(*_critSectList);
CriticalSectionScoped cs(_critSectList);
if ((_id != -1) || (_numOfWorkThreads != 0)) {
assert(_id == -1);
assert(_numOfWorkThreads == 0);

View File

@ -179,7 +179,7 @@ WebRtc_Word32 UdpTransportImpl::ChangeUniqueId(const WebRtc_Word32 id)
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id,
"ChangeUniqueId(new id:%d)", id);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
_id = id;
if(_mgr)
{
@ -300,7 +300,7 @@ WebRtc_Word32 UdpTransportImpl::InitializeReceiveSockets(
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
{
CriticalSectionScoped cs(*_critPacketCallback);
CriticalSectionScoped cs(_critPacketCallback);
_packetCallback = packetCallback;
if(packetCallback == NULL)
@ -311,7 +311,7 @@ WebRtc_Word32 UdpTransportImpl::InitializeReceiveSockets(
}
}
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
CloseReceiveSockets();
if(portnr == 0)
@ -427,7 +427,7 @@ WebRtc_Word32 UdpTransportImpl::ReceiveSocketInformation(
WebRtc_Word8 multicastIpAddr[kIpAddressVersion6Length]) const
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
rtpPort = _localPort;
rtcpPort = _localPortRTCP;
if (ipAddr)
@ -451,7 +451,7 @@ WebRtc_Word32 UdpTransportImpl::SendSocketInformation(
WebRtc_UWord16& rtcpPort) const
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
rtpPort = _destPort;
rtcpPort = _destPortRTCP;
strncpy(ipAddr, _destIP, IpV6Enabled() ?
@ -466,7 +466,7 @@ WebRtc_Word32 UdpTransportImpl::RemoteSocketInformation(
WebRtc_UWord16& rtcpPort) const
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
rtpPort = _fromPort;
rtcpPort = _fromPortRTCP;
if(ipAddr)
@ -483,7 +483,7 @@ WebRtc_Word32 UdpTransportImpl::FilterPorts(
WebRtc_UWord16& rtcpFilterPort) const
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_critFilter);
CriticalSectionScoped cs(_critFilter);
rtpFilterPort = _rtpFilterPort;
rtcpFilterPort = _rtcpFilterPort;
return 0;
@ -559,7 +559,7 @@ WebRtc_Word32 UdpTransportImpl::EnableQoS(WebRtc_Word32 serviceType,
return -1;
}
}
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
UdpSocketWrapper* rtpSock = _ptrSendRtpSocket ?
_ptrSendRtpSocket :
@ -734,7 +734,7 @@ WebRtc_Word32 UdpTransportImpl::DisableQoS()
{
return 0;
}
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
UdpSocketWrapper* rtpSock = (_ptrSendRtpSocket ?
_ptrSendRtpSocket : _ptrRtpSocket);
@ -784,7 +784,7 @@ WebRtc_Word32 UdpTransportImpl::QoS(bool& QoS, WebRtc_Word32& serviceType,
WebRtc_Word32& overrideDSCP) const
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
QoS = _qos;
serviceType = _serviceType;
overrideDSCP = _overrideDSCP;
@ -819,7 +819,7 @@ WebRtc_Word32 UdpTransportImpl::SetToS(WebRtc_Word32 DSCP, bool useSetSockOpt)
return -1;
}
}
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
UdpSocketWrapper* rtpSock = NULL;
UdpSocketWrapper* rtcpSock = NULL;
if(_ptrSendRtpSocket)
@ -992,7 +992,7 @@ WebRtc_Word32 UdpTransportImpl::ToS(WebRtc_Word32& DSCP,
bool& useSetSockOpt) const
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
DSCP = _tos;
useSetSockOpt = _useSetSockOpt;
return 0;
@ -1015,7 +1015,7 @@ WebRtc_Word32 UdpTransportImpl::SetPCP(WebRtc_Word32 PCP)
return -1;
}
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
UdpSocketWrapper* rtpSock = NULL;
UdpSocketWrapper* rtcpSock = NULL;
if(_ptrSendRtpSocket)
@ -1098,7 +1098,7 @@ WebRtc_Word32 UdpTransportImpl::SetPCP(WebRtc_Word32 PCP)
WebRtc_Word32 UdpTransportImpl::PCP(WebRtc_Word32& PCP) const
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
PCP = _pcp;
return 0;
}
@ -1112,7 +1112,7 @@ bool UdpTransportImpl::SetSockOptUsed()
WebRtc_Word32 UdpTransportImpl::EnableIpV6()
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
if(_IpV6EnabledRead)
{
if(_ipV6Enabled)
@ -1143,7 +1143,7 @@ WebRtc_Word32 UdpTransportImpl::FilterIP(
WEBRTC_TRACE(kTraceError, kTraceTransport, _id, "No Filter configured");
return -1;
}
CriticalSectionScoped cs(*_critFilter);
CriticalSectionScoped cs(_critFilter);
WebRtc_UWord32 ipSize = kIpAddressVersion6Length;
WebRtc_UWord16 sourcePort;
return IPAddress(_filterIPAddress, filterIPAddress, ipSize, sourcePort);
@ -1159,7 +1159,7 @@ WebRtc_Word32 UdpTransportImpl::SetFilterIP(
WEBRTC_TRACE(kTraceDebug, kTraceTransport, _id, "Filter IP reset");
return 0;
}
CriticalSectionScoped cs(*_critFilter);
CriticalSectionScoped cs(_critFilter);
if (_ipV6Enabled)
{
_filterIPAddress._sockaddr_storage.sin_family = AF_INET6;
@ -1198,7 +1198,7 @@ WebRtc_Word32 UdpTransportImpl::SetFilterPorts(WebRtc_UWord16 rtpFilterPort,
WebRtc_UWord16 rtcpFilterPort)
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_critFilter);
CriticalSectionScoped cs(_critFilter);
_rtpFilterPort = rtpFilterPort;
_rtcpFilterPort = rtcpFilterPort;
return 0;
@ -1207,7 +1207,7 @@ WebRtc_Word32 UdpTransportImpl::SetFilterPorts(WebRtc_UWord16 rtpFilterPort,
bool UdpTransportImpl::SendSocketsInitialized() const
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
if(_ptrSendRtpSocket)
{
return true;
@ -1569,7 +1569,7 @@ WebRtc_Word32 UdpTransportImpl::InitializeSourcePorts(WebRtc_UWord16 rtpPort,
return -1;
}
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
CloseSendSockets();
@ -1613,7 +1613,7 @@ WebRtc_Word32 UdpTransportImpl::InitializeSourcePorts(WebRtc_UWord16 rtpPort,
WebRtc_Word32 UdpTransportImpl::SourcePorts(WebRtc_UWord16& rtpPort,
WebRtc_UWord16& rtcpPort) const
{
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
rtpPort = (_srcPort != 0) ? _srcPort : _localPort;
rtcpPort = (_srcPortRTCP != 0) ? _srcPortRTCP : _localPortRTCP;
@ -1630,7 +1630,7 @@ WebRtc_Word32 UdpTransportImpl::StartReceiving(
#endif
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
if(_receiving)
{
return 0;
@ -1681,7 +1681,7 @@ WebRtc_Word32 UdpTransportImpl::StopReceiving()
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
_receiving = false;
@ -1715,7 +1715,7 @@ WebRtc_Word32 UdpTransportImpl::InitializeSendSockets(
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
{
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
_destPort = rtpPort;
if(rtcpPort == 0)
{
@ -1774,7 +1774,7 @@ WebRtc_Word32 UdpTransportImpl::InitializeSendSockets(
if((val > 223) && (val < 240))
{
// Multicast address.
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
UdpSocketWrapper* rtpSock = (_ptrSendRtpSocket ?
_ptrSendRtpSocket : _ptrRtpSocket);
@ -1858,7 +1858,7 @@ WebRtc_Word32 UdpTransportImpl::SendRaw(const WebRtc_Word8 *data,
const WebRtc_Word8 *ip)
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
if(isRTCP)
{
UdpSocketWrapper* rtcpSock = NULL;
@ -1933,7 +1933,7 @@ WebRtc_Word32 UdpTransportImpl::SendRTPPacketTo(const WebRtc_Word8* data,
const SocketAddress& to)
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
if(_ptrSendRtpSocket)
{
return _ptrSendRtpSocket->SendTo(data,length,to);
@ -1951,7 +1951,7 @@ WebRtc_Word32 UdpTransportImpl::SendRTCPPacketTo(const WebRtc_Word8* data,
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
if(_ptrSendRtcpSocket)
{
@ -1970,7 +1970,7 @@ WebRtc_Word32 UdpTransportImpl::SendRTPPacketTo(const WebRtc_Word8* data,
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
// Use the current SocketAdress but update it with rtpPort.
SocketAddress to;
memcpy(&to, &_remoteRTPAddr, sizeof(SocketAddress));
@ -1999,7 +1999,7 @@ WebRtc_Word32 UdpTransportImpl::SendRTCPPacketTo(const WebRtc_Word8* data,
const WebRtc_UWord16 rtcpPort)
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
// Use the current SocketAdress but update it with rtcpPort.
SocketAddress to;
@ -2028,7 +2028,7 @@ int UdpTransportImpl::SendPacket(int /*channel*/, const void* data, int length)
{
WEBRTC_TRACE(kTraceStream, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
if(_destIP[0] == 0)
{
@ -2096,7 +2096,7 @@ int UdpTransportImpl::SendRTCPPacket(int /*channel*/, const void* data,
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
if(_destIP[0] == 0)
{
return -1;
@ -2164,7 +2164,7 @@ WebRtc_Word32 UdpTransportImpl::SetSendIP(const WebRtc_Word8* ipaddr)
{
return kIpAddressInvalid;
}
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
strncpy(_destIP, ipaddr,kIpAddressVersion6Length);
BuildRemoteRTPAddr();
BuildRemoteRTCPAddr();
@ -2175,7 +2175,7 @@ WebRtc_Word32 UdpTransportImpl::SetSendPorts(WebRtc_UWord16 rtpPort,
WebRtc_UWord16 rtcpPort)
{
WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__);
CriticalSectionScoped cs(*_crit);
CriticalSectionScoped cs(_crit);
_destPort = rtpPort;
if(rtcpPort == 0)
{
@ -2223,7 +2223,7 @@ void UdpTransportImpl::IncomingRTPFunction(const WebRtc_Word8* rtpPacket,
WebRtc_UWord16 portNr = 0;
{
CriticalSectionScoped cs(*_critFilter);
CriticalSectionScoped cs(_critFilter);
if (FilterIPAddress(fromSocket) == false)
{
// Packet should be filtered out. Drop it.
@ -2265,7 +2265,7 @@ void UdpTransportImpl::IncomingRTPFunction(const WebRtc_Word8* rtpPacket,
_fromPort = portNr;
}
CriticalSectionScoped cs(*_critPacketCallback);
CriticalSectionScoped cs(_critPacketCallback);
if (_packetCallback)
{
WEBRTC_TRACE(kTraceStream, kTraceTransport, _id,
@ -2284,7 +2284,7 @@ void UdpTransportImpl::IncomingRTCPFunction(const WebRtc_Word8* rtcpPacket,
WebRtc_UWord16 portNr = 0;
{
CriticalSectionScoped cs(*_critFilter);
CriticalSectionScoped cs(_critFilter);
if (FilterIPAddress(fromSocket) == false)
{
// Packet should be filtered out. Drop it.
@ -2322,7 +2322,7 @@ void UdpTransportImpl::IncomingRTCPFunction(const WebRtc_Word8* rtcpPacket,
_fromPortRTCP = portNr;
}
CriticalSectionScoped cs(*_critPacketCallback);
CriticalSectionScoped cs(_critPacketCallback);
if (_packetCallback)
{
WEBRTC_TRACE(kTraceStream, kTraceTransport, _id,