From 65573f29222a2139776ac93982836e949ea5f958 Mon Sep 17 00:00:00 2001 From: "henrike@webrtc.org" Date: Tue, 13 Dec 2011 19:17:27 +0000 Subject: [PATCH] Removed usage of the deprecated critical section constructor in rtp_rtcp. Review URL: http://webrtc-codereview.appspot.com/315004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1173 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../rtp_rtcp/source/bandwidth_management.cc | 4 +- .../rtp_rtcp/source/bandwidth_management.h | 2 +- src/modules/rtp_rtcp/source/dtmf_queue.cc | 4 +- src/modules/rtp_rtcp/source/dtmf_queue.h | 2 +- src/modules/rtp_rtcp/source/rtcp_receiver.cc | 13 +++--- src/modules/rtp_rtcp/source/rtcp_receiver.h | 4 +- src/modules/rtp_rtcp/source/rtcp_sender.cc | 8 ++-- src/modules/rtp_rtcp/source/rtcp_sender.h | 4 +- src/modules/rtp_rtcp/source/rtp_receiver.cc | 9 ++-- src/modules/rtp_rtcp/source/rtp_receiver.h | 4 +- .../rtp_rtcp/source/rtp_receiver_audio.cc | 4 +- .../rtp_rtcp/source/rtp_receiver_audio.h | 2 +- .../rtp_rtcp/source/rtp_receiver_video.cc | 44 +++++++++---------- .../rtp_rtcp/source/rtp_receiver_video.h | 4 +- src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 9 ++-- src/modules/rtp_rtcp/source/rtp_rtcp_impl.h | 4 +- src/modules/rtp_rtcp/source/rtp_sender.cc | 12 ++--- src/modules/rtp_rtcp/source/rtp_sender.h | 6 +-- .../rtp_rtcp/source/rtp_sender_audio.cc | 20 ++++----- .../rtp_rtcp/source/rtp_sender_audio.h | 4 +- .../rtp_rtcp/source/rtp_sender_video.cc | 4 +- .../rtp_rtcp/source/rtp_sender_video.h | 2 +- src/modules/rtp_rtcp/source/ssrc_database.cc | 6 +-- src/modules/rtp_rtcp/source/tmmbr_help.cc | 4 +- src/modules/rtp_rtcp/source/tmmbr_help.h | 2 +- .../test/BWEStandAlone/BWETestBase.cpp | 4 +- .../rtp_rtcp/test/BWEStandAlone/BWETestBase.h | 2 +- .../rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc | 38 ++++++++-------- .../test/BWEStandAlone/TestLoadGenerator.cc | 4 +- .../test/BWEStandAlone/TestLoadGenerator.h | 2 +- .../test/BWEStandAlone/TestSenderReceiver.cc | 8 ++-- .../test/BWEStandAlone/TestSenderReceiver.h | 2 +- 32 files changed, 121 insertions(+), 120 deletions(-) diff --git a/src/modules/rtp_rtcp/source/bandwidth_management.cc b/src/modules/rtp_rtcp/source/bandwidth_management.cc index aa279e9688..9d5cf68b39 100644 --- a/src/modules/rtp_rtcp/source/bandwidth_management.cc +++ b/src/modules/rtp_rtcp/source/bandwidth_management.cc @@ -19,7 +19,7 @@ namespace webrtc { BandwidthManagement::BandwidthManagement(const WebRtc_Word32 id) : _id(id), - _critsect(*CriticalSectionWrapper::CreateCriticalSection()), + _critsect(CriticalSectionWrapper::CreateCriticalSection()), _lastPacketLossExtendedHighSeqNum(0), _lastReportAllLost(false), _lastLoss(0), @@ -39,7 +39,7 @@ BandwidthManagement::BandwidthManagement(const WebRtc_Word32 id) : BandwidthManagement::~BandwidthManagement() { - delete &_critsect; + delete _critsect; } WebRtc_Word32 diff --git a/src/modules/rtp_rtcp/source/bandwidth_management.h b/src/modules/rtp_rtcp/source/bandwidth_management.h index aeb32b6bc1..6761820fc4 100644 --- a/src/modules/rtp_rtcp/source/bandwidth_management.h +++ b/src/modules/rtp_rtcp/source/bandwidth_management.h @@ -64,7 +64,7 @@ private: WebRtc_Word32 _id; - CriticalSectionWrapper& _critsect; + CriticalSectionWrapper* _critsect; // incoming filters WebRtc_UWord32 _lastPacketLossExtendedHighSeqNum; diff --git a/src/modules/rtp_rtcp/source/dtmf_queue.cc b/src/modules/rtp_rtcp/source/dtmf_queue.cc index 72cd735dd1..749309b6b1 100644 --- a/src/modules/rtp_rtcp/source/dtmf_queue.cc +++ b/src/modules/rtp_rtcp/source/dtmf_queue.cc @@ -14,7 +14,7 @@ namespace webrtc { DTMFqueue::DTMFqueue(): - _DTMFCritsect(*CriticalSectionWrapper::CreateCriticalSection()), + _DTMFCritsect(CriticalSectionWrapper::CreateCriticalSection()), _nextEmptyIndex(0) { memset(_DTMFKey,0, sizeof(_DTMFKey)); @@ -24,7 +24,7 @@ DTMFqueue::DTMFqueue(): DTMFqueue::~DTMFqueue() { - delete &_DTMFCritsect; + delete _DTMFCritsect; } WebRtc_Word32 diff --git a/src/modules/rtp_rtcp/source/dtmf_queue.h b/src/modules/rtp_rtcp/source/dtmf_queue.h index 67c47d0c70..8451a211b5 100644 --- a/src/modules/rtp_rtcp/source/dtmf_queue.h +++ b/src/modules/rtp_rtcp/source/dtmf_queue.h @@ -29,7 +29,7 @@ public: void ResetDTMF(); private: - CriticalSectionWrapper& _DTMFCritsect; + CriticalSectionWrapper* _DTMFCritsect; WebRtc_UWord8 _nextEmptyIndex; WebRtc_UWord8 _DTMFKey[DTMF_OUTBAND_MAX]; WebRtc_UWord16 _DTMFLen[DTMF_OUTBAND_MAX]; diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver.cc b/src/modules/rtp_rtcp/source/rtcp_receiver.cc index dabfe7106b..9b76e468bb 100644 --- a/src/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/src/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -35,10 +35,11 @@ RTCPReceiver::RTCPReceiver(const WebRtc_Word32 id, _method(kRtcpOff), _lastReceived(0), _rtpRtcp(*owner), - _criticalSectionFeedbacks(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionFeedbacks(CriticalSectionWrapper::CreateCriticalSection()), _cbRtcpFeedback(NULL), _cbVideoFeedback(NULL), - _criticalSectionRTCPReceiver(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionRTCPReceiver( + CriticalSectionWrapper::CreateCriticalSection()), _SSRC(0), _remoteSSRC(0), _remoteSenderInfo(), @@ -53,8 +54,8 @@ RTCPReceiver::RTCPReceiver(const WebRtc_Word32 id, RTCPReceiver::~RTCPReceiver() { - delete &_criticalSectionRTCPReceiver; - delete &_criticalSectionFeedbacks; + delete _criticalSectionRTCPReceiver; + delete _criticalSectionFeedbacks; bool loop = true; do @@ -481,13 +482,13 @@ RTCPReceiver::HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket, } } - _criticalSectionRTCPReceiver.Leave(); + _criticalSectionRTCPReceiver->Leave(); // to avoid problem with accuireing _criticalSectionRTCPSender while holding _criticalSectionRTCPReceiver WebRtc_UWord32 sendTimeMS = _rtpRtcp.SendTimeOfSendReport(rtcpPacket.ReportBlockItem.LastSR); - _criticalSectionRTCPReceiver.Enter(); + _criticalSectionRTCPReceiver->Enter(); // ReportBlockItem.SSRC is who it's to // we store all incoming reports, used in conference relay diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver.h b/src/modules/rtp_rtcp/source/rtcp_receiver.h index cac5a69900..5d8f14334f 100644 --- a/src/modules/rtp_rtcp/source/rtcp_receiver.h +++ b/src/modules/rtp_rtcp/source/rtcp_receiver.h @@ -187,11 +187,11 @@ private: WebRtc_UWord32 _lastReceived; ModuleRtpRtcpImpl& _rtpRtcp; - CriticalSectionWrapper& _criticalSectionFeedbacks; + CriticalSectionWrapper* _criticalSectionFeedbacks; RtcpFeedback* _cbRtcpFeedback; RtpVideoFeedback* _cbVideoFeedback; - CriticalSectionWrapper& _criticalSectionRTCPReceiver; + CriticalSectionWrapper* _criticalSectionRTCPReceiver; WebRtc_UWord32 _SSRC; WebRtc_UWord32 _remoteSSRC; diff --git a/src/modules/rtp_rtcp/source/rtcp_sender.cc b/src/modules/rtp_rtcp/source/rtcp_sender.cc index cf9885c717..2ae88fc7e6 100644 --- a/src/modules/rtp_rtcp/source/rtcp_sender.cc +++ b/src/modules/rtp_rtcp/source/rtcp_sender.cc @@ -31,10 +31,10 @@ RTCPSender::RTCPSender(const WebRtc_Word32 id, _clock(*clock), _method(kRtcpOff), _rtpRtcp(*owner), - _criticalSectionTransport(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionTransport(CriticalSectionWrapper::CreateCriticalSection()), _cbTransport(NULL), - _criticalSectionRTCPSender(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionRTCPSender(CriticalSectionWrapper::CreateCriticalSection()), _usingNack(false), _sending(false), _sendTMMBN(false), @@ -112,8 +112,8 @@ RTCPSender::~RTCPSender() _csrcCNAMEs.Erase(item); item = _csrcCNAMEs.First(); } - delete &_criticalSectionTransport; - delete &_criticalSectionRTCPSender; + delete _criticalSectionTransport; + delete _criticalSectionRTCPSender; WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id, "%s deleted", __FUNCTION__); } diff --git a/src/modules/rtp_rtcp/source/rtcp_sender.h b/src/modules/rtp_rtcp/source/rtcp_sender.h index e744afd2f4..109d4b5621 100644 --- a/src/modules/rtp_rtcp/source/rtcp_sender.h +++ b/src/modules/rtp_rtcp/source/rtcp_sender.h @@ -178,10 +178,10 @@ private: ModuleRtpRtcpImpl& _rtpRtcp; - CriticalSectionWrapper& _criticalSectionTransport; + CriticalSectionWrapper* _criticalSectionTransport; Transport* _cbTransport; - CriticalSectionWrapper& _criticalSectionRTCPSender; + CriticalSectionWrapper* _criticalSectionRTCPSender; bool _usingNack; bool _sending; bool _sendTMMBN; diff --git a/src/modules/rtp_rtcp/source/rtp_receiver.cc b/src/modules/rtp_rtcp/source/rtp_receiver.cc index 26fdb9bb3d..570fa7e62f 100644 --- a/src/modules/rtp_rtcp/source/rtp_receiver.cc +++ b/src/modules/rtp_rtcp/source/rtp_receiver.cc @@ -31,11 +31,12 @@ RTPReceiver::RTPReceiver(const WebRtc_Word32 id, _id(id), _audio(audio), _rtpRtcp(*owner), - _criticalSectionCbs(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionCbs(CriticalSectionWrapper::CreateCriticalSection()), _cbRtpFeedback(NULL), _cbRtpData(NULL), - _criticalSectionRTPReceiver(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionRTPReceiver( + CriticalSectionWrapper::CreateCriticalSection()), _lastReceiveTime(0), _lastReceivedPayloadLength(0), _lastReceivedPayloadType(-1), @@ -101,8 +102,8 @@ RTPReceiver::~RTPReceiver() _cbRtpFeedback->OnIncomingCSRCChanged(_id,_currentRemoteCSRC[i], false); } } - delete &_criticalSectionCbs; - delete &_criticalSectionRTPReceiver; + delete _criticalSectionCbs; + delete _criticalSectionRTPReceiver; // empty map bool loop = true; diff --git a/src/modules/rtp_rtcp/source/rtp_receiver.h b/src/modules/rtp_rtcp/source/rtp_receiver.h index 03a3b0d795..a289fbffdb 100644 --- a/src/modules/rtp_rtcp/source/rtp_receiver.h +++ b/src/modules/rtp_rtcp/source/rtp_receiver.h @@ -174,11 +174,11 @@ private: const bool _audio; ModuleRtpRtcpImpl& _rtpRtcp; - CriticalSectionWrapper& _criticalSectionCbs; + CriticalSectionWrapper* _criticalSectionCbs; RtpFeedback* _cbRtpFeedback; RtpData* _cbRtpData; - CriticalSectionWrapper& _criticalSectionRTPReceiver; + CriticalSectionWrapper* _criticalSectionRTPReceiver; mutable WebRtc_UWord32 _lastReceiveTime; WebRtc_UWord16 _lastReceivedPayloadLength; WebRtc_Word8 _lastReceivedPayloadType; diff --git a/src/modules/rtp_rtcp/source/rtp_receiver_audio.cc b/src/modules/rtp_rtcp/source/rtp_receiver_audio.cc index 2458725ca6..cb75c9e3ee 100644 --- a/src/modules/rtp_rtcp/source/rtp_receiver_audio.cc +++ b/src/modules/rtp_rtcp/source/rtp_receiver_audio.cc @@ -31,14 +31,14 @@ RTPReceiverAudio::RTPReceiverAudio(const WebRtc_Word32 id): _cngPayloadType(-1), _G722PayloadType(-1), _lastReceivedG722(false), - _criticalSectionFeedback(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionFeedback(CriticalSectionWrapper::CreateCriticalSection()), _cbAudioFeedback(NULL) { } RTPReceiverAudio::~RTPReceiverAudio() { - delete &_criticalSectionFeedback; + delete _criticalSectionFeedback; } WebRtc_Word32 diff --git a/src/modules/rtp_rtcp/source/rtp_receiver_audio.h b/src/modules/rtp_rtcp/source/rtp_receiver_audio.h index 6fe9bf543b..8a7172af8b 100644 --- a/src/modules/rtp_rtcp/source/rtp_receiver_audio.h +++ b/src/modules/rtp_rtcp/source/rtp_receiver_audio.h @@ -89,7 +89,7 @@ private: WebRtc_Word8 _G722PayloadType; bool _lastReceivedG722; - CriticalSectionWrapper& _criticalSectionFeedback; + CriticalSectionWrapper* _criticalSectionFeedback; RtpAudioFeedback* _cbAudioFeedback; }; } // namespace webrtc diff --git a/src/modules/rtp_rtcp/source/rtp_receiver_video.cc b/src/modules/rtp_rtcp/source/rtp_receiver_video.cc index a681760954..051f752bee 100644 --- a/src/modules/rtp_rtcp/source/rtp_receiver_video.cc +++ b/src/modules/rtp_rtcp/source/rtp_receiver_video.cc @@ -28,10 +28,10 @@ RTPReceiverVideo::RTPReceiverVideo(const WebRtc_Word32 id, ModuleRtpRtcpImpl* owner): _id(id), _rtpRtcp(*owner), - _criticalSectionFeedback(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionFeedback(CriticalSectionWrapper::CreateCriticalSection()), _cbVideoFeedback(NULL), - _criticalSectionReceiverVideo(*CriticalSectionWrapper::CreateCriticalSection()), - + _criticalSectionReceiverVideo( + CriticalSectionWrapper::CreateCriticalSection()), _completeFrame(false), _packetStartTimeMs(0), _receivedBW(), @@ -49,8 +49,8 @@ RTPReceiverVideo::RTPReceiverVideo(const WebRtc_Word32 id, RTPReceiverVideo::~RTPReceiverVideo() { - delete &_criticalSectionFeedback; - delete &_criticalSectionReceiverVideo; + delete _criticalSectionFeedback; + delete _criticalSectionReceiverVideo; delete _receiveFEC; } @@ -228,7 +228,7 @@ RTPReceiverVideo::ParseVideoCodecSpecific(WebRtcRTPHeader* rtpHeader, { WebRtc_Word32 retVal = 0; - _criticalSectionReceiverVideo.Enter(); + _criticalSectionReceiverVideo->Enter(); _videoBitRate.Update(payloadDataLength, nowMS); @@ -242,7 +242,7 @@ RTPReceiverVideo::ParseVideoCodecSpecific(WebRtcRTPHeader* rtpHeader, { if(_receiveFEC == NULL) { - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); return -1; } if (rtpHeader->header.timestamp != TimeStamp()) @@ -269,7 +269,7 @@ RTPReceiverVideo::ParseVideoCodecSpecific(WebRtcRTPHeader* rtpHeader, _receiveFEC->AddReceivedFECInfo(rtpHeader,incomingRtpPacket, FECpacket); } } - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); if(retVal == 0 && FECpacket ) { @@ -296,18 +296,18 @@ RTPReceiverVideo::ParseVideoCodecSpecific(WebRtcRTPHeader* rtpHeader, // Update the remote rate control object and update the overuse // detector with the current rate control region. - _criticalSectionReceiverVideo.Enter(); + _criticalSectionReceiverVideo->Enter(); const RateControlInput input(_overUseDetector.State(), _videoBitRate.BitRate(nowMS), _overUseDetector.NoiseVar()); - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); // Call the callback outside critical section const RateControlRegion region = _rtpRtcp.OnOverUseStateUpdate(input); - _criticalSectionReceiverVideo.Enter(); + _criticalSectionReceiverVideo->Enter(); _overUseDetector.SetRateControlRegion(region); - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); return retVal; } @@ -356,7 +356,7 @@ RTPReceiverVideo::ReceiveRecoveredPacketCallback(WebRtcRTPHeader* rtpHeader, const WebRtc_UWord8* payloadData, const WebRtc_UWord16 payloadDataLength) { - _criticalSectionReceiverVideo.Enter(); + _criticalSectionReceiverVideo->Enter(); _currentFecFrameDecoded = true; @@ -450,7 +450,7 @@ RTPReceiverVideo::ParseVideoCodecSpecificSwitch(WebRtcRTPHeader* rtpHeader, retVal = ReceiveMPEG4Codec(rtpHeader,payloadData, payloadDataLength); break; default: - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); assert(((void)"ParseCodecSpecific videoType can not be unknown here!", false)); return -1; } @@ -470,7 +470,7 @@ RTPReceiverVideo::ReceiveH263Codec(WebRtcRTPHeader* rtpHeader, const bool success = rtpPayloadParser.Parse(parsedPacket); // from here down we only work on local data - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); if (!success) { @@ -498,17 +498,17 @@ RTPReceiverVideo::ReceiveH2631998Codec(WebRtcRTPHeader* rtpHeader, const bool success = rtpPayloadParser.Parse(parsedPacket); if (!success) { - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); return -1; } if (IP_PACKET_SIZE < parsedPacket.info.H263.dataLength + (parsedPacket.info.H263.insert2byteStartCode ? 2 : 0)) { - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); return -1; } // from here down we only work on local data - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); return ReceiveH263CodecCommon(parsedPacket, rtpHeader); } @@ -590,11 +590,11 @@ RTPReceiverVideo::ReceiveMPEG4Codec(WebRtcRTPHeader* rtpHeader, const bool success = rtpPayloadParser.Parse(parsedPacket); if (!success) { - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); return -1; } // from here down we only work on local data - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); rtpHeader->frameType = (parsedPacket.frameType == ModuleRTPUtility::kIFrame) ? kVideoFrameKey : kVideoFrameDelta; rtpHeader->type.Video.isFirstPacket = parsedPacket.info.MPEG4.isFirstPacket; @@ -622,7 +622,7 @@ RTPReceiverVideo::ReceiveVp8Codec(WebRtcRTPHeader* rtpHeader, const bool success = rtpPayloadParser.Parse(parsedPacket); // from here down we only work on local data - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); if (!success) { @@ -681,7 +681,7 @@ RTPReceiverVideo::ReceiveGenericCodec(WebRtcRTPHeader* rtpHeader, { rtpHeader->type.Video.isFirstPacket = true; } - _criticalSectionReceiverVideo.Leave(); + _criticalSectionReceiverVideo->Leave(); if(CallbackOfReceivedPayloadData(payloadData, payloadDataLength, rtpHeader) != 0) { diff --git a/src/modules/rtp_rtcp/source/rtp_receiver_video.h b/src/modules/rtp_rtcp/source/rtp_receiver_video.h index 737699a42d..78934267ba 100644 --- a/src/modules/rtp_rtcp/source/rtp_receiver_video.h +++ b/src/modules/rtp_rtcp/source/rtp_receiver_video.h @@ -132,10 +132,10 @@ private: WebRtc_Word32 _id; ModuleRtpRtcpImpl& _rtpRtcp; - CriticalSectionWrapper& _criticalSectionFeedback; + CriticalSectionWrapper* _criticalSectionFeedback; RtpVideoFeedback* _cbVideoFeedback; - CriticalSectionWrapper& _criticalSectionReceiverVideo; + CriticalSectionWrapper* _criticalSectionReceiverVideo; // bandwidth bool _completeFrame; diff --git a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index a18f69063f..23d55b2356 100644 --- a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -89,8 +89,9 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const WebRtc_Word32 id, _lastProcessTime(clock->GetTimeInMS()), _packetOverHead(28), // IPV4 UDP - _criticalSectionModulePtrs(*CriticalSectionWrapper::CreateCriticalSection()), - _criticalSectionModulePtrsFeedback(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionModulePtrs(CriticalSectionWrapper::CreateCriticalSection()), + _criticalSectionModulePtrsFeedback( + CriticalSectionWrapper::CreateCriticalSection()), _defaultModule(NULL), _audioModule(NULL), _videoModule(NULL), @@ -165,8 +166,8 @@ ModuleRtpRtcpImpl::~ModuleRtpRtcpImpl() } #endif - delete &_criticalSectionModulePtrs; - delete &_criticalSectionModulePtrsFeedback; + delete _criticalSectionModulePtrs; + delete _criticalSectionModulePtrsFeedback; } WebRtc_Word32 diff --git a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h index c0269cf0ef..5da611ade1 100644 --- a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -544,8 +544,8 @@ private: WebRtc_UWord32 _lastProcessTime; WebRtc_UWord16 _packetOverHead; - CriticalSectionWrapper& _criticalSectionModulePtrs; - CriticalSectionWrapper& _criticalSectionModulePtrsFeedback; + CriticalSectionWrapper* _criticalSectionModulePtrs; + CriticalSectionWrapper* _criticalSectionModulePtrsFeedback; ModuleRtpRtcpImpl* _defaultModule; ModuleRtpRtcpImpl* _audioModule; ModuleRtpRtcpImpl* _videoModule; diff --git a/src/modules/rtp_rtcp/source/rtp_sender.cc b/src/modules/rtp_rtcp/source/rtp_sender.cc index 617faf79a4..2af0dbfe34 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender.cc +++ b/src/modules/rtp_rtcp/source/rtp_sender.cc @@ -27,8 +27,8 @@ RTPSender::RTPSender(const WebRtc_Word32 id, _audioConfigured(audio), _audio(NULL), _video(NULL), - _sendCritsect(*CriticalSectionWrapper::CreateCriticalSection()), - _transportCritsect(*CriticalSectionWrapper::CreateCriticalSection()), + _sendCritsect(CriticalSectionWrapper::CreateCriticalSection()), + _transportCritsect(CriticalSectionWrapper::CreateCriticalSection()), _transport(NULL), @@ -48,7 +48,7 @@ RTPSender::RTPSender(const WebRtc_Word32 id, _storeSentPackets(false), _storeSentPacketsNumber(0), - _prevSentPacketsCritsect(*CriticalSectionWrapper::CreateCriticalSection()), + _prevSentPacketsCritsect(CriticalSectionWrapper::CreateCriticalSection()), _prevSentPacketsIndex(0), _ptrPrevSentPackets(NULL), _prevSentPacketsSeqNum(NULL), @@ -107,9 +107,9 @@ RTPSender::~RTPSender() _ssrcDB.ReturnSSRC(_ssrc); SSRCDatabase::ReturnSSRCDatabase(); - delete &_prevSentPacketsCritsect; - delete &_sendCritsect; - delete &_transportCritsect; + delete _prevSentPacketsCritsect; + delete _sendCritsect; + delete _transportCritsect; // empty map bool loop = true; diff --git a/src/modules/rtp_rtcp/source/rtp_sender.h b/src/modules/rtp_rtcp/source/rtp_sender.h index b4d17a3fec..0d47926220 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender.h +++ b/src/modules/rtp_rtcp/source/rtp_sender.h @@ -267,9 +267,9 @@ private: RTPSenderAudio* _audio; RTPSenderVideo* _video; - CriticalSectionWrapper& _sendCritsect; + CriticalSectionWrapper* _sendCritsect; - CriticalSectionWrapper& _transportCritsect; + CriticalSectionWrapper* _transportCritsect; Transport* _transport; bool _sendingMedia; @@ -288,7 +288,7 @@ private: bool _storeSentPackets; WebRtc_UWord16 _storeSentPacketsNumber; - CriticalSectionWrapper& _prevSentPacketsCritsect; + CriticalSectionWrapper* _prevSentPacketsCritsect; WebRtc_Word32 _prevSentPacketsIndex; WebRtc_Word8** _ptrPrevSentPackets; WebRtc_UWord16* _prevSentPacketsSeqNum; diff --git a/src/modules/rtp_rtcp/source/rtp_sender_audio.cc b/src/modules/rtp_rtcp/source/rtp_sender_audio.cc index 5d690c19bb..854f394bf9 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender_audio.cc +++ b/src/modules/rtp_rtcp/source/rtp_sender_audio.cc @@ -19,9 +19,9 @@ RTPSenderAudio::RTPSenderAudio(const WebRtc_Word32 id, RtpRtcpClock* clock, _id(id), _clock(*clock), _rtpSender(rtpSender), - _audioFeedbackCritsect(*CriticalSectionWrapper::CreateCriticalSection()), + _audioFeedbackCritsect(CriticalSectionWrapper::CreateCriticalSection()), _audioFeedback(NULL), - _sendAudioCritsect(*CriticalSectionWrapper::CreateCriticalSection()), + _sendAudioCritsect(CriticalSectionWrapper::CreateCriticalSection()), _frequency(8000), _packetSizeSamples(160), _dtmfEventIsOn(false), @@ -46,8 +46,8 @@ RTPSenderAudio::RTPSenderAudio(const WebRtc_Word32 id, RtpRtcpClock* clock, RTPSenderAudio::~RTPSenderAudio() { - delete &_sendAudioCritsect; - delete &_audioFeedbackCritsect; + delete _sendAudioCritsect; + delete _audioFeedbackCritsect; } WebRtc_Word32 @@ -296,7 +296,7 @@ RTPSenderAudio::SendAudio(const FrameType frameType, // A source MAY send events and coded audio packets for the same time // but we don't support it { - _sendAudioCritsect.Enter(); + _sendAudioCritsect->Enter(); if (_dtmfEventIsOn) { @@ -307,7 +307,7 @@ RTPSenderAudio::SendAudio(const FrameType frameType, if(_packetSizeSamples > (captureTimeStamp - _dtmfTimestampLastSent) ) { // not time to send yet - _sendAudioCritsect.Leave(); + _sendAudioCritsect->Leave(); return 0; } } @@ -333,7 +333,7 @@ RTPSenderAudio::SendAudio(const FrameType frameType, _dtmfTimeLastSent = _clock.GetTimeInMS(); } // don't hold the critsect while calling SendTelephoneEventPacket - _sendAudioCritsect.Leave(); + _sendAudioCritsect->Leave(); if(send) { if(dtmfDurationSamples > 0xffff) @@ -357,7 +357,7 @@ RTPSenderAudio::SendAudio(const FrameType frameType, } return(0); } - _sendAudioCritsect.Leave(); + _sendAudioCritsect->Leave(); } if(payloadSize == 0 || payloadData == NULL) { @@ -627,7 +627,7 @@ RTPSenderAudio::SendTelephoneEventPacket(const bool ended, } do { - _sendAudioCritsect.Enter(); + _sendAudioCritsect->Enter(); //Send DTMF data _rtpSender->BuildRTPheader(dtmfbuffer, _dtmfPayloadType, markerBit, dtmfTimeStamp); @@ -661,7 +661,7 @@ RTPSenderAudio::SendTelephoneEventPacket(const bool ended, dtmfbuffer[13] = E|R|volume; ModuleRTPUtility::AssignUWord16ToBuffer(dtmfbuffer+14, duration); - _sendAudioCritsect.Leave(); + _sendAudioCritsect->Leave(); retVal = _rtpSender->SendToNetwork(dtmfbuffer, 4, 12); sendCount--; diff --git a/src/modules/rtp_rtcp/source/rtp_sender_audio.h b/src/modules/rtp_rtcp/source/rtp_sender_audio.h index 0e0b20bdc2..d51a473053 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender_audio.h +++ b/src/modules/rtp_rtcp/source/rtp_sender_audio.h @@ -95,10 +95,10 @@ private: WebRtc_Word32 _id; RtpRtcpClock& _clock; RTPSenderInterface* _rtpSender; - CriticalSectionWrapper& _audioFeedbackCritsect; + CriticalSectionWrapper* _audioFeedbackCritsect; RtpAudioFeedback* _audioFeedback; - CriticalSectionWrapper& _sendAudioCritsect; + CriticalSectionWrapper* _sendAudioCritsect; WebRtc_UWord32 _frequency; WebRtc_UWord16 _packetSizeSamples; diff --git a/src/modules/rtp_rtcp/source/rtp_sender_video.cc b/src/modules/rtp_rtcp/source/rtp_sender_video.cc index ecd9e8d8cc..a8a78d0b51 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender_video.cc +++ b/src/modules/rtp_rtcp/source/rtp_sender_video.cc @@ -30,7 +30,7 @@ RTPSenderVideo::RTPSenderVideo(const WebRtc_Word32 id, RTPSenderInterface* rtpSender) : _id(id), _rtpSender(*rtpSender), - _sendVideoCritsect(*CriticalSectionWrapper::CreateCriticalSection()), + _sendVideoCritsect(CriticalSectionWrapper::CreateCriticalSection()), _videoType(kRtpNoVideo), _videoCodecInformation(NULL), @@ -63,7 +63,7 @@ RTPSenderVideo::~RTPSenderVideo() { delete _videoCodecInformation; } - delete &_sendVideoCritsect; + delete _sendVideoCritsect; } WebRtc_Word32 diff --git a/src/modules/rtp_rtcp/source/rtp_sender_video.h b/src/modules/rtp_rtcp/source/rtp_sender_video.h index 47f5ec7cf6..989205ff7b 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender_video.h +++ b/src/modules/rtp_rtcp/source/rtp_sender_video.h @@ -150,7 +150,7 @@ private: WebRtc_Word32 _id; RTPSenderInterface& _rtpSender; - CriticalSectionWrapper& _sendVideoCritsect; + CriticalSectionWrapper* _sendVideoCritsect; RtpVideoCodecTypes _videoType; VideoCodecInformation* _videoCodecInformation; WebRtc_UWord32 _maxBitrate; diff --git a/src/modules/rtp_rtcp/source/ssrc_database.cc b/src/modules/rtp_rtcp/source/ssrc_database.cc index befc5eea8f..b3e9ab007c 100644 --- a/src/modules/rtp_rtcp/source/ssrc_database.cc +++ b/src/modules/rtp_rtcp/source/ssrc_database.cc @@ -54,7 +54,7 @@ SSRCDatabase::ReturnSSRCDatabase() WebRtc_UWord32 SSRCDatabase::CreateSSRC() { - CriticalSectionScoped lock(*_critSect); + CriticalSectionScoped lock(_critSect); WebRtc_UWord32 ssrc = GenerateRandom(); @@ -103,7 +103,7 @@ SSRCDatabase::CreateSSRC() WebRtc_Word32 SSRCDatabase::RegisterSSRC(const WebRtc_UWord32 ssrc) { - CriticalSectionScoped lock(*_critSect); + CriticalSectionScoped lock(_critSect); #ifndef WEBRTC_NO_STL @@ -143,7 +143,7 @@ SSRCDatabase::RegisterSSRC(const WebRtc_UWord32 ssrc) WebRtc_Word32 SSRCDatabase::ReturnSSRC(const WebRtc_UWord32 ssrc) { - CriticalSectionScoped lock(*_critSect); + CriticalSectionScoped lock(_critSect); #ifndef WEBRTC_NO_STL _ssrcMap.erase(ssrc); diff --git a/src/modules/rtp_rtcp/source/tmmbr_help.cc b/src/modules/rtp_rtcp/source/tmmbr_help.cc index 43537f8313..cf34e087e2 100644 --- a/src/modules/rtp_rtcp/source/tmmbr_help.cc +++ b/src/modules/rtp_rtcp/source/tmmbr_help.cc @@ -62,7 +62,7 @@ TMMBRSet::VerifyAndAllocateSet(WebRtc_UWord32 minimumSize) } TMMBRHelp::TMMBRHelp(const bool audio) : - _criticalSection(*CriticalSectionWrapper::CreateCriticalSection()), + _criticalSection(CriticalSectionWrapper::CreateCriticalSection()), _audio(audio), _candidateSet(), _boundingSet(), @@ -78,7 +78,7 @@ TMMBRHelp::~TMMBRHelp() delete [] _ptrMaxPRBoundingSet; _ptrIntersectionBoundingSet = 0; _ptrMaxPRBoundingSet = 0; - delete &_criticalSection; + delete _criticalSection; } TMMBRSet* diff --git a/src/modules/rtp_rtcp/source/tmmbr_help.h b/src/modules/rtp_rtcp/source/tmmbr_help.h index 0575f1d002..35704fe5a7 100644 --- a/src/modules/rtp_rtcp/source/tmmbr_help.h +++ b/src/modules/rtp_rtcp/source/tmmbr_help.h @@ -65,7 +65,7 @@ protected: WebRtc_Word32 FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidateSet); private: - CriticalSectionWrapper& _criticalSection; + CriticalSectionWrapper* _criticalSection; const bool _audio; TMMBRSet _candidateSet; TMMBRSet _boundingSet; diff --git a/src/modules/rtp_rtcp/test/BWEStandAlone/BWETestBase.cpp b/src/modules/rtp_rtcp/test/BWEStandAlone/BWETestBase.cpp index edc26c8730..2940abd90f 100644 --- a/src/modules/rtp_rtcp/test/BWEStandAlone/BWETestBase.cpp +++ b/src/modules/rtp_rtcp/test/BWEStandAlone/BWETestBase.cpp @@ -199,7 +199,7 @@ _eventPtr(NULL), _procThread(NULL), _startTimeMs(-1), _stopTimeMs(-1), -_statCritSect(*CriticalSectionWrapper::CreateCriticalSection()) +_statCritSect(CriticalSectionWrapper::CreateCriticalSection()) { _sendrec = new TestSenderReceiver(); } @@ -212,7 +212,7 @@ BWETest::~BWETest() Stop(); } - _statCritSect.Enter(); + _statCritSect->Enter(); delete &_statCritSect; if (_sendrec) diff --git a/src/modules/rtp_rtcp/test/BWEStandAlone/BWETestBase.h b/src/modules/rtp_rtcp/test/BWEStandAlone/BWETestBase.h index 2dccdb0cc5..bab1b94fd4 100644 --- a/src/modules/rtp_rtcp/test/BWEStandAlone/BWETestBase.h +++ b/src/modules/rtp_rtcp/test/BWEStandAlone/BWETestBase.h @@ -76,7 +76,7 @@ protected: WebRtc_Word64 _stopTimeMs; // Statistics, protected by separate CritSect - CriticalSectionWrapper& _statCritSect; + CriticalSectionWrapper* _statCritSect; StatVec _rateVecKbps; StatVec _rttVecMs; StatVec _lossVec; diff --git a/src/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc b/src/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc index e708b0f801..9c81fd0d24 100644 --- a/src/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc +++ b/src/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc @@ -386,7 +386,7 @@ _firstPlot(true), _legendEnabled(true), _donePlottingEvent(EventWrapper::Create()) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); _xlim[0] = 0; _xlim[1] = 0; @@ -419,7 +419,7 @@ MatlabPlot::~MatlabPlot() int MatlabPlot::AddLine(int maxLen /*= -1*/, const char *plotAttrib /*= NULL*/, const char *name /*= NULL*/) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (!_enabled) { return -1; @@ -435,7 +435,7 @@ int MatlabPlot::AddLine(int maxLen /*= -1*/, const char *plotAttrib /*= NULL*/, int MatlabPlot::AddTimeLine(int maxLen /*= -1*/, const char *plotAttrib /*= NULL*/, const char *name /*= NULL*/, WebRtc_Word64 refTimeMs /*= -1*/) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (!_enabled) { @@ -451,7 +451,7 @@ int MatlabPlot::AddTimeLine(int maxLen /*= -1*/, const char *plotAttrib /*= NULL int MatlabPlot::GetLineIx(const char *name) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (!_enabled) { @@ -485,7 +485,7 @@ int MatlabPlot::GetLineIx(const char *name) void MatlabPlot::Append(int lineIndex, double x, double y) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (!_enabled) { @@ -505,7 +505,7 @@ void MatlabPlot::Append(int lineIndex, double x, double y) void MatlabPlot::Append(int lineIndex, double y) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (!_enabled) { @@ -525,7 +525,7 @@ void MatlabPlot::Append(int lineIndex, double y) int MatlabPlot::Append(const char *name, double x, double y) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (!_enabled) { @@ -548,7 +548,7 @@ int MatlabPlot::Append(const char *name, double x, double y) int MatlabPlot::Append(const char *name, double y) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (!_enabled) { @@ -571,7 +571,7 @@ int MatlabPlot::Append(const char *name, double y) int MatlabPlot::Length(char *name) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (!_enabled) { @@ -592,7 +592,7 @@ int MatlabPlot::Length(char *name) void MatlabPlot::SetPlotAttribute(char *name, char *plotAttrib) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (!_enabled) { @@ -789,7 +789,7 @@ bool MatlabPlot::DataAvailable() void MatlabPlot::Plot() { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); _timeToPlot = true; @@ -801,7 +801,7 @@ void MatlabPlot::Plot() void MatlabPlot::Reset() { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); _enabled = true; @@ -814,7 +814,7 @@ void MatlabPlot::Reset() void MatlabPlot::SetFigHandle(int handle) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (handle > 0) _figHandle = handle; @@ -823,21 +823,21 @@ void MatlabPlot::SetFigHandle(int handle) bool MatlabPlot::TimeToPlot() { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); return _enabled && _timeToPlot; } void MatlabPlot::Plotting() { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); _plotting = true; } void MatlabPlot::DonePlotting() { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); _timeToPlot = false; _plotting = false; _donePlottingEvent->Set(); @@ -858,7 +858,7 @@ MatlabPlot::DisablePlot() int MatlabPlot::MakeTrend(const char *sourceName, const char *trendName, double slope, double offset, const char *plotAttrib) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); int sourceIx; int trendIx; @@ -941,7 +941,7 @@ MatlabEngine::~MatlabEngine() MatlabPlot * MatlabEngine::NewPlot(MatlabPlot *newPlot) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); //MatlabPlot *newPlot = new MatlabPlot(); @@ -958,7 +958,7 @@ MatlabPlot * MatlabEngine::NewPlot(MatlabPlot *newPlot) void MatlabEngine::DeletePlot(MatlabPlot *plot) { - CriticalSectionScoped cs(*_critSect); + CriticalSectionScoped cs(_critSect); if (plot == NULL) { diff --git a/src/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc b/src/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc index 20ffe609a4..d322242332 100644 --- a/src/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc +++ b/src/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc @@ -33,7 +33,7 @@ bool SenderThreadFunction(void *obj) TestLoadGenerator::TestLoadGenerator(TestSenderReceiver *sender, WebRtc_Word32 rtpSampleRate) : -_critSect(*CriticalSectionWrapper::CreateCriticalSection()), +_critSect(CriticalSectionWrapper::CreateCriticalSection()), _eventPtr(NULL), _genThread(NULL), _bitrateKbps(0), @@ -50,7 +50,7 @@ TestLoadGenerator::~TestLoadGenerator () Stop(); } - delete &_critSect; + delete _critSect; } WebRtc_Word32 TestLoadGenerator::SetBitrate (WebRtc_Word32 newBitrateKbps) diff --git a/src/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h b/src/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h index 4ab75192eb..c22591cfc6 100644 --- a/src/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h +++ b/src/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h @@ -42,7 +42,7 @@ protected: const WebRtc_UWord32 payloadSize, const webrtc::FrameType frameType = webrtc::kVideoFrameDelta); - webrtc::CriticalSectionWrapper& _critSect; + webrtc::CriticalSectionWrapper* _critSect; webrtc::EventWrapper *_eventPtr; webrtc::ThreadWrapper* _genThread; WebRtc_Word32 _bitrateKbps; diff --git a/src/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc b/src/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc index 2e8270a331..1fc0fd37ad 100644 --- a/src/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc +++ b/src/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc @@ -37,7 +37,7 @@ bool ProcThreadFunction(void *obj) TestSenderReceiver::TestSenderReceiver (void) : -_critSect(*CriticalSectionWrapper::CreateCriticalSection()), +_critSect(CriticalSectionWrapper::CreateCriticalSection()), _eventPtr(NULL), _procThread(NULL), _running(false), @@ -85,7 +85,7 @@ TestSenderReceiver::~TestSenderReceiver (void) Stop(); // N.B. without critSect - _critSect.Enter(); + _critSect->Enter(); if (_rtp) { @@ -99,7 +99,7 @@ TestSenderReceiver::~TestSenderReceiver (void) _transport = NULL; } - delete &_critSect; + delete _critSect; } @@ -440,5 +440,3 @@ void TestSenderReceiver::OnNetworkChanged(const WebRtc_Word32 id, bwEstimateKbitMax); } } - - diff --git a/src/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h b/src/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h index cc9ccdd9c9..7f7f2f0011 100644 --- a/src/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h +++ b/src/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h @@ -148,7 +148,7 @@ public: private: RtpRtcp* _rtp; UdpTransport* _transport; - webrtc::CriticalSectionWrapper& _critSect; + webrtc::CriticalSectionWrapper* _critSect; webrtc::EventWrapper *_eventPtr; webrtc::ThreadWrapper* _procThread; bool _running;