fixing the racing conditions
git-svn-id: http://webrtc.googlecode.com/svn/trunk@1025 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
859626570a
commit
83661f534e
@ -250,6 +250,8 @@ Channel::SendRTCPPacket(int channel, const void *data, int len)
|
|||||||
WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId),
|
WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||||
"Channel::SendRTCPPacket(channel=%d, len=%d)", channel, len);
|
"Channel::SendRTCPPacket(channel=%d, len=%d)", channel, len);
|
||||||
|
|
||||||
|
{
|
||||||
|
CriticalSectionScoped cs(_callbackCritSect);
|
||||||
if (_transportPtr == NULL)
|
if (_transportPtr == NULL)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceVoice,
|
WEBRTC_TRACE(kTraceError, kTraceVoice,
|
||||||
@ -258,6 +260,7 @@ Channel::SendRTCPPacket(int channel, const void *data, int len)
|
|||||||
" due to invalid transport object");
|
" due to invalid transport object");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WebRtc_UWord8* bufferToSendPtr = (WebRtc_UWord8*)data;
|
WebRtc_UWord8* bufferToSendPtr = (WebRtc_UWord8*)data;
|
||||||
WebRtc_Word32 bufferLength = len;
|
WebRtc_Word32 bufferLength = len;
|
||||||
@ -1532,7 +1535,12 @@ Channel::Init()
|
|||||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||||
// Ensure that the WebRtcSocketTransport implementation is used as
|
// Ensure that the WebRtcSocketTransport implementation is used as
|
||||||
// Transport on the sending side
|
// Transport on the sending side
|
||||||
|
{
|
||||||
|
// A lock is needed here since users can call
|
||||||
|
// RegisterExternalTransport() at the same time.
|
||||||
|
CriticalSectionScoped cs(_callbackCritSect);
|
||||||
_transportPtr = &_socketTransportModule;
|
_transportPtr = &_socketTransportModule;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize the far end AP module
|
// Initialize the far end AP module
|
||||||
@ -2803,6 +2811,8 @@ Channel::DeRegisterExternalTransport()
|
|||||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||||
"Channel::DeRegisterExternalTransport()");
|
"Channel::DeRegisterExternalTransport()");
|
||||||
|
|
||||||
|
CriticalSectionScoped cs(_callbackCritSect);
|
||||||
|
|
||||||
if (!_transportPtr)
|
if (!_transportPtr)
|
||||||
{
|
{
|
||||||
_engineStatisticsPtr->SetLastError(
|
_engineStatisticsPtr->SetLastError(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user