From 1853005f37189d704e69a9c7703e912e1df5d278 Mon Sep 17 00:00:00 2001 From: "pwestin@webrtc.org" Date: Tue, 3 Jul 2012 10:41:54 +0000 Subject: [PATCH] Change clock to be 64 bits in RTP module Review URL: https://webrtc-codereview.appspot.com/678011 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2488 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../rtp_rtcp/interface/rtp_rtcp_defines.h | 2 +- src/modules/rtp_rtcp/source/Bitrate.h | 20 +- src/modules/rtp_rtcp/source/bitrate.cc | 112 +++++------- src/modules/rtp_rtcp/source/rtcp_receiver.cc | 11 +- src/modules/rtp_rtcp/source/rtcp_receiver.h | 4 +- .../rtp_rtcp/source/rtcp_receiver_help.cc | 172 +++++++----------- .../rtp_rtcp/source/rtcp_receiver_help.h | 27 +-- .../rtp_rtcp/source/rtcp_receiver_unittest.cc | 4 +- src/modules/rtp_rtcp/source/rtcp_sender.cc | 2 +- src/modules/rtp_rtcp/source/rtcp_sender.h | 2 +- .../rtp_rtcp/source/rtp_packet_history.cc | 8 +- .../rtp_rtcp/source/rtp_packet_history.h | 12 +- .../source/rtp_packet_history_unittest.cc | 12 +- src/modules/rtp_rtcp/source/rtp_receiver.cc | 9 +- src/modules/rtp_rtcp/source/rtp_receiver.h | 19 +- src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 14 +- src/modules/rtp_rtcp/source/rtp_rtcp_impl.h | 8 +- src/modules/rtp_rtcp/source/rtp_sender.cc | 10 +- src/modules/rtp_rtcp/source/rtp_sender.h | 4 +- .../rtp_rtcp/source/rtp_sender_audio.cc | 5 +- .../rtp_rtcp/source/rtp_sender_audio.h | 8 +- .../rtp_rtcp/source/rtp_sender_unittest.cc | 4 +- src/modules/rtp_rtcp/source/rtp_utility.cc | 21 +-- src/modules/rtp_rtcp/test/testAPI/test_api.h | 4 +- 24 files changed, 216 insertions(+), 278 deletions(-) diff --git a/src/modules/rtp_rtcp/interface/rtp_rtcp_defines.h b/src/modules/rtp_rtcp/interface/rtp_rtcp_defines.h index 6bc787ee73..5adb0e8a07 100644 --- a/src/modules/rtp_rtcp/interface/rtp_rtcp_defines.h +++ b/src/modules/rtp_rtcp/interface/rtp_rtcp_defines.h @@ -245,7 +245,7 @@ class RtpRtcpClock { // Return a timestamp in milliseconds relative to some arbitrary // source; the source is fixed for this clock. - virtual WebRtc_UWord32 GetTimeInMS() = 0; + virtual WebRtc_Word64 GetTimeInMS() = 0; // Retrieve an NTP absolute timestamp. virtual void CurrentNTP(WebRtc_UWord32& secs, WebRtc_UWord32& frac) = 0; diff --git a/src/modules/rtp_rtcp/source/Bitrate.h b/src/modules/rtp_rtcp/source/Bitrate.h index 074476bdac..be45343ec4 100644 --- a/src/modules/rtp_rtcp/source/Bitrate.h +++ b/src/modules/rtp_rtcp/source/Bitrate.h @@ -41,18 +41,18 @@ public: WebRtc_UWord32 BitrateNow() const; protected: - RtpRtcpClock& _clock; + RtpRtcpClock& _clock; private: - WebRtc_UWord32 _packetRate; - WebRtc_UWord32 _bitrate; - WebRtc_UWord8 _bitrateNextIdx; - WebRtc_UWord32 _packetRateArray[10]; - WebRtc_UWord32 _bitrateArray[10]; - WebRtc_UWord32 _bitrateDiffMS[10]; - WebRtc_UWord32 _timeLastRateUpdate; - WebRtc_UWord32 _bytesCount; - WebRtc_UWord32 _packetCount; + WebRtc_UWord32 _packetRate; + WebRtc_UWord32 _bitrate; + WebRtc_UWord8 _bitrateNextIdx; + WebRtc_Word64 _packetRateArray[10]; + WebRtc_Word64 _bitrateArray[10]; + WebRtc_Word64 _bitrateDiffMS[10]; + WebRtc_Word64 _timeLastRateUpdate; + WebRtc_UWord32 _bytesCount; + WebRtc_UWord32 _packetCount; }; } // namespace webrtc diff --git a/src/modules/rtp_rtcp/source/bitrate.cc b/src/modules/rtp_rtcp/source/bitrate.cc index 8f09034003..38cf537974 100644 --- a/src/modules/rtp_rtcp/source/bitrate.cc +++ b/src/modules/rtp_rtcp/source/bitrate.cc @@ -39,75 +39,63 @@ Bitrate::PacketRate() const return _packetRate; } -WebRtc_UWord32 -Bitrate::BitrateLast() const -{ - return _bitrate; +WebRtc_UWord32 Bitrate::BitrateLast() const { + return _bitrate; } -WebRtc_UWord32 -Bitrate::BitrateNow() const -{ - WebRtc_UWord32 now = _clock.GetTimeInMS(); - WebRtc_UWord32 diffMS = now -_timeLastRateUpdate; +WebRtc_UWord32 Bitrate::BitrateNow() const { + WebRtc_Word64 now = _clock.GetTimeInMS(); + WebRtc_Word64 diffMS = now -_timeLastRateUpdate; - if(diffMS > 10000) // 10 sec - { - // too high diff ignore - return _bitrate; // bits/s - } - WebRtc_UWord64 bitsSinceLastRateUpdate = 8*_bytesCount*1000; + if(diffMS > 10000) { // 10 sec + // too high diff ignore + return _bitrate; // bits/s + } + WebRtc_Word64 bitsSinceLastRateUpdate = 8 * _bytesCount * 1000; - // have to consider the time when the measurement was done - // ((bits/sec * sec) + (bits)) / sec - WebRtc_UWord64 bitrate = (((WebRtc_UWord64)_bitrate * 1000) + bitsSinceLastRateUpdate)/(1000+diffMS); - return (WebRtc_UWord32)bitrate; + // have to consider the time when the measurement was done + // ((bits/sec * sec) + (bits)) / sec + WebRtc_Word64 bitrate = (static_cast(_bitrate) * 1000 + + bitsSinceLastRateUpdate) / (1000 + diffMS); + return static_cast(bitrate); } -void -Bitrate::Process() -{ - // triggered by timer - WebRtc_UWord32 now = _clock.GetTimeInMS(); - WebRtc_UWord32 diffMS = now -_timeLastRateUpdate; +void Bitrate::Process() { + // Triggered by timer. + WebRtc_Word64 now = _clock.GetTimeInMS(); + WebRtc_Word64 diffMS = now -_timeLastRateUpdate; - if(diffMS > 100) - { - if(diffMS > 10000) // 10 sec - { - // too high diff ignore - _timeLastRateUpdate = now; - _bytesCount = 0; - _packetCount = 0; - return; - } - _packetRateArray[_bitrateNextIdx] = (_packetCount*1000)/diffMS; - _bitrateArray[_bitrateNextIdx] = 8*((_bytesCount*1000)/diffMS); - // will overflow at ~34 Mbit/s - _bitrateDiffMS[_bitrateNextIdx] = diffMS; - _bitrateNextIdx++; - if(_bitrateNextIdx >= 10) - { - _bitrateNextIdx = 0; - } - - WebRtc_UWord32 sumDiffMS = 0; - WebRtc_UWord64 sumBitrateMS = 0; - WebRtc_UWord32 sumPacketrateMS = 0; - for(int i= 0; i <10; i++) - { - // sum of time - sumDiffMS += _bitrateDiffMS[i]; - sumBitrateMS += _bitrateArray[i] * _bitrateDiffMS[i]; - sumPacketrateMS += _packetRateArray[i] * _bitrateDiffMS[i]; - } - _timeLastRateUpdate = now; - _bytesCount = 0; - _packetCount = 0; - - _packetRate = sumPacketrateMS/sumDiffMS; - _bitrate = WebRtc_UWord32(sumBitrateMS / sumDiffMS); - } + if (diffMS < 100) { + // Not enough data, wait... + return; + } + if (diffMS > 10000) { // 10 sec + // too high diff ignore + _timeLastRateUpdate = now; + _bytesCount = 0; + _packetCount = 0; + return; + } + _packetRateArray[_bitrateNextIdx] = (_packetCount * 1000) / diffMS; + _bitrateArray[_bitrateNextIdx] = 8 * ((_bytesCount * 1000) / diffMS); + _bitrateDiffMS[_bitrateNextIdx] = diffMS; + _bitrateNextIdx++; + if (_bitrateNextIdx >= 10) { + _bitrateNextIdx = 0; + } + WebRtc_Word64 sumDiffMS = 0; + WebRtc_Word64 sumBitrateMS = 0; + WebRtc_Word64 sumPacketrateMS = 0; + for (int i = 0; i < 10; i++) { + sumDiffMS += _bitrateDiffMS[i]; + sumBitrateMS += _bitrateArray[i] * _bitrateDiffMS[i]; + sumPacketrateMS += _packetRateArray[i] * _bitrateDiffMS[i]; + } + _timeLastRateUpdate = now; + _bytesCount = 0; + _packetCount = 0; + _packetRate = static_cast(sumPacketrateMS / sumDiffMS); + _bitrate = static_cast(sumBitrateMS / sumDiffMS); } } // namespace webrtc diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver.cc b/src/modules/rtp_rtcp/source/rtcp_receiver.cc index 7d80d181d5..4d0f7d99d5 100644 --- a/src/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/src/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -101,7 +101,7 @@ RTCPReceiver::SetRTCPStatus(const RTCPMethod method) return 0; } -WebRtc_UWord32 +WebRtc_Word64 RTCPReceiver::LastReceived() { CriticalSectionScoped lock(_criticalSectionRTCPReceiver); @@ -617,7 +617,7 @@ bool RTCPReceiver::UpdateRTCPReceiveInformationTimers() { CriticalSectionScoped lock(_criticalSectionRTCPReceiver); bool updateBoundingSet = false; - WebRtc_UWord32 timeNow = _clock.GetTimeInMS(); + WebRtc_Word64 timeNow = _clock.GetTimeInMS(); std::map::iterator receiveInfoIt = _receivedInfoMap.begin(); @@ -1090,7 +1090,7 @@ void RTCPReceiver::HandleFIRItem(RTCPReceiveInformation* receiveInfo, // check if we have reported this FIRSequenceNumber before if (rtcpPacket.FIRItem.CommandSequenceNumber != receiveInfo->lastFIRSequenceNumber) { - WebRtc_UWord32 now = _clock.GetTimeInMS(); + WebRtc_Word64 now = _clock.GetTimeInMS(); // sanity; don't go crazy with the callbacks if ((now - receiveInfo->lastFIRRequest) > RTCP_MIN_FRAME_LENGTH_MS) { receiveInfo->lastFIRRequest = now; @@ -1245,7 +1245,7 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket( if ((rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSr || rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRr) && rtcpPacketInformation.reportBlock) { - WebRtc_UWord32 now = _clock.GetTimeInMS(); + WebRtc_Word64 now = _clock.GetTimeInMS(); _cbRtcpBandwidthObserver->OnReceivedRtcpReceiverReport( rtcpPacketInformation.remoteSSRC, rtcpPacketInformation.fractionLost, @@ -1359,8 +1359,7 @@ void RTCPReceiver::PacketTimeout() return; } - WebRtc_UWord32 now = _clock.GetTimeInMS(); - + WebRtc_Word64 now = _clock.GetTimeInMS(); if(now - _lastReceived > _packetTimeOutMS) { packetTimeOut = true; diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver.h b/src/modules/rtp_rtcp/source/rtcp_receiver.h index ff6f19af9b..c587ebb698 100644 --- a/src/modules/rtp_rtcp/source/rtcp_receiver.h +++ b/src/modules/rtp_rtcp/source/rtcp_receiver.h @@ -36,7 +36,7 @@ public: RTCPMethod Status() const; WebRtc_Word32 SetRTCPStatus(const RTCPMethod method); - WebRtc_UWord32 LastReceived(); + WebRtc_Word64 LastReceived(); void SetSSRC( const WebRtc_UWord32 ssrc); void SetRelaySSRC( const WebRtc_UWord32 ssrc); @@ -189,7 +189,7 @@ protected: WebRtc_Word32 _id; RtpRtcpClock& _clock; RTCPMethod _method; - WebRtc_UWord32 _lastReceived; + WebRtc_Word64 _lastReceived; ModuleRtpRtcpImpl& _rtpRtcp; CriticalSectionWrapper* _criticalSectionFeedbacks; diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver_help.cc b/src/modules/rtp_rtcp/source/rtcp_receiver_help.cc index 1b74c685ad..81e33ac0c5 100644 --- a/src/modules/rtp_rtcp/source/rtcp_receiver_help.cc +++ b/src/modules/rtp_rtcp/source/rtcp_receiver_help.cc @@ -9,10 +9,11 @@ */ #include "rtcp_receiver_help.h" -#include "rtp_utility.h" -#include //memset -#include //assert +#include // memset +#include // assert + +#include "modules/rtp_rtcp/source/rtp_utility.h" namespace webrtc { using namespace RTCPHelp; @@ -52,9 +53,8 @@ RTCPPacketInformation::AddVoIPMetric(const RTCPVoIPMetric* metric) memcpy(VoIPMetric, metric, sizeof(RTCPVoIPMetric)); } -void -RTCPPacketInformation::AddApplicationData(const WebRtc_UWord8* data, const WebRtc_UWord16 size) -{ +void RTCPPacketInformation::AddApplicationData(const WebRtc_UWord8* data, + const WebRtc_UWord16 size) { WebRtc_UWord8* oldData = applicationData; WebRtc_UWord16 oldLength = applicationLength; @@ -67,7 +67,7 @@ RTCPPacketInformation::AddApplicationData(const WebRtc_UWord8* data, const WebRt applicationLength += copySize; applicationData = new WebRtc_UWord8[applicationLength]; - if(oldData) + if (oldData) { memcpy(applicationData, oldData, oldLength); memcpy(applicationData+oldLength, data, copySize); @@ -81,7 +81,7 @@ RTCPPacketInformation::AddApplicationData(const WebRtc_UWord8* data, const WebRt void RTCPPacketInformation::ResetNACKPacketIdArray() { - if(NULL == nackSequenceNumbers) + if (NULL == nackSequenceNumbers) { nackSequenceNumbers = new WebRtc_UWord16[NACK_PACKETS_MAX_SIZE]; } @@ -129,112 +129,78 @@ RTCPReportBlockInformation::~RTCPReportBlockInformation() { } -RTCPReceiveInformation::RTCPReceiveInformation() : - - lastTimeReceived(0), - lastFIRSequenceNumber(-1), - lastFIRRequest(0), - readyForDelete(false), - _tmmbrSetTimeouts(NULL) -{ +RTCPReceiveInformation::RTCPReceiveInformation() + : lastTimeReceived(0), + lastFIRSequenceNumber(-1), + lastFIRRequest(0), + readyForDelete(false) { } -RTCPReceiveInformation::~RTCPReceiveInformation() -{ - if(_tmmbrSetTimeouts) - { - delete [] _tmmbrSetTimeouts; - } +RTCPReceiveInformation::~RTCPReceiveInformation() { } // Increase size of TMMBRSet if needed, and also take care of -// the _tmmbrSetTimeouts array. -void -RTCPReceiveInformation::VerifyAndAllocateTMMBRSet(const WebRtc_UWord32 minimumSize) -{ - if(minimumSize > TmmbrSet.sizeOfSet()) - { - TmmbrSet.VerifyAndAllocateSetKeepingData(minimumSize); - // make sure that our buffers are big enough - WebRtc_UWord32* tmmbrSetTimeouts = new WebRtc_UWord32[minimumSize]; - - if(TmmbrSet.lengthOfSet() > 0) - { - memcpy(tmmbrSetTimeouts, _tmmbrSetTimeouts, - sizeof(WebRtc_UWord32) * TmmbrSet.lengthOfSet()); - } - if(_tmmbrSetTimeouts) - { - delete [] _tmmbrSetTimeouts; - } - _tmmbrSetTimeouts = tmmbrSetTimeouts; - } +// the _tmmbrSetTimeouts vector. +void RTCPReceiveInformation::VerifyAndAllocateTMMBRSet( + const WebRtc_UWord32 minimumSize) { + if (minimumSize > TmmbrSet.sizeOfSet()) { + TmmbrSet.VerifyAndAllocateSetKeepingData(minimumSize); + // make sure that our buffers are big enough + _tmmbrSetTimeouts.reserve(minimumSize); + } } -void -RTCPReceiveInformation::InsertTMMBRItem(const WebRtc_UWord32 senderSSRC, - const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem, - const WebRtc_UWord32 currentTimeMS) -{ - // serach to see if we have it in our list - for(WebRtc_UWord32 i = 0; i < TmmbrSet.lengthOfSet(); i++) - { - if(TmmbrSet.Ssrc(i) == senderSSRC) - { - // we already have this SSRC in our list - // update it - TmmbrSet.SetEntry(i, - TMMBRItem.MaxTotalMediaBitRate, - TMMBRItem.MeasuredOverhead, - senderSSRC); - _tmmbrSetTimeouts[i] = currentTimeMS; - return; - } +void RTCPReceiveInformation::InsertTMMBRItem( + const WebRtc_UWord32 senderSSRC, + const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem, + const WebRtc_Word64 currentTimeMS) { + // serach to see if we have it in our list + for (WebRtc_UWord32 i = 0; i < TmmbrSet.lengthOfSet(); i++) { + if (TmmbrSet.Ssrc(i) == senderSSRC) { + // we already have this SSRC in our list update it + TmmbrSet.SetEntry(i, + TMMBRItem.MaxTotalMediaBitRate, + TMMBRItem.MeasuredOverhead, + senderSSRC); + _tmmbrSetTimeouts[i] = currentTimeMS; + return; } - const WebRtc_UWord32 idx = TmmbrSet.lengthOfSet(); - VerifyAndAllocateTMMBRSet(idx+1); - TmmbrSet.AddEntry(TMMBRItem.MaxTotalMediaBitRate, - TMMBRItem.MeasuredOverhead, - senderSSRC); - _tmmbrSetTimeouts[idx] = currentTimeMS; + } + VerifyAndAllocateTMMBRSet(TmmbrSet.lengthOfSet() + 1); + TmmbrSet.AddEntry(TMMBRItem.MaxTotalMediaBitRate, + TMMBRItem.MeasuredOverhead, + senderSSRC); + _tmmbrSetTimeouts.push_back(currentTimeMS); } -WebRtc_Word32 -RTCPReceiveInformation::GetTMMBRSet(const WebRtc_UWord32 sourceIdx, - const WebRtc_UWord32 targetIdx, - TMMBRSet* candidateSet, - const WebRtc_UWord32 currentTimeMS) -{ - if(sourceIdx >= TmmbrSet.lengthOfSet()) - { - return -1; - } - if(targetIdx >= candidateSet->sizeOfSet()) - { - return -1; - } - WebRtc_UWord32 timeNow = currentTimeMS; - - // use audio define since we don't know what interval the remote peer is using - if(timeNow - _tmmbrSetTimeouts[sourceIdx] > 5*RTCP_INTERVAL_AUDIO_MS) - { - // value timed out - TmmbrSet.RemoveEntry(sourceIdx); - const WebRtc_UWord32 move = TmmbrSet.lengthOfSet() - (sourceIdx + 1); - if (move > 0) { - memmove(&(_tmmbrSetTimeouts[sourceIdx]),&(_tmmbrSetTimeouts[sourceIdx+1]), move* sizeof(WebRtc_UWord32)); - } - return -1; - } - candidateSet->SetEntry(targetIdx, - TmmbrSet.Tmmbr(sourceIdx), - TmmbrSet.PacketOH(sourceIdx), - TmmbrSet.Ssrc(sourceIdx)); - return 0; +WebRtc_Word32 RTCPReceiveInformation::GetTMMBRSet( + const WebRtc_UWord32 sourceIdx, + const WebRtc_UWord32 targetIdx, + TMMBRSet* candidateSet, + const WebRtc_Word64 currentTimeMS) { + if (sourceIdx >= TmmbrSet.lengthOfSet()) { + return -1; + } + if (targetIdx >= candidateSet->sizeOfSet()) { + return -1; + } + // use audio define since we don't know what interval the remote peer is using + if (currentTimeMS - _tmmbrSetTimeouts[sourceIdx] > + 5 * RTCP_INTERVAL_AUDIO_MS) { + // value timed out + TmmbrSet.RemoveEntry(sourceIdx); + _tmmbrSetTimeouts.erase(_tmmbrSetTimeouts.begin() + sourceIdx); + return -1; + } + candidateSet->SetEntry(targetIdx, + TmmbrSet.Tmmbr(sourceIdx), + TmmbrSet.PacketOH(sourceIdx), + TmmbrSet.Ssrc(sourceIdx)); + return 0; } -void RTCPReceiveInformation::VerifyAndAllocateBoundingSet(const WebRtc_UWord32 minimumSize) -{ - TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize); +void RTCPReceiveInformation::VerifyAndAllocateBoundingSet( + const WebRtc_UWord32 minimumSize) { + TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize); } } // namespace webrtc diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver_help.h b/src/modules/rtp_rtcp/source/rtcp_receiver_help.h index 6dcaca8323..a7214300be 100644 --- a/src/modules/rtp_rtcp/source/rtcp_receiver_help.h +++ b/src/modules/rtp_rtcp/source/rtcp_receiver_help.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -11,12 +11,12 @@ #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_HELP_H_ #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_HELP_H_ -#include "typedefs.h" +#include -#include "rtp_rtcp_defines.h" // RTCPReportBlock -#include "rtp_rtcp_config.h" // RTCP_MAX_REPORT_BLOCKS -#include "rtcp_utility.h" -#include "tmmbr_help.h" +#include "modules/rtp_rtcp/interface/rtp_rtcp_defines.h" // RTCPReportBlock +#include "modules/rtp_rtcp/source/rtcp_utility.h" +#include "modules/rtp_rtcp/source/tmmbr_help.h" +#include "typedefs.h" namespace webrtc { namespace RTCPHelp @@ -30,7 +30,8 @@ public: void AddVoIPMetric(const RTCPVoIPMetric* metric); - void AddApplicationData(const WebRtc_UWord8* data, const WebRtc_UWord16 size); + void AddApplicationData(const WebRtc_UWord8* data, + const WebRtc_UWord16 size); void AddNACKPacket(const WebRtc_UWord16 packetID); void ResetNACKPacketIdArray(); @@ -96,19 +97,19 @@ public: void InsertTMMBRItem(const WebRtc_UWord32 senderSSRC, const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem, - const WebRtc_UWord32 currentTimeMS); + const WebRtc_Word64 currentTimeMS); // get WebRtc_Word32 GetTMMBRSet(const WebRtc_UWord32 sourceIdx, const WebRtc_UWord32 targetIdx, TMMBRSet* candidateSet, - const WebRtc_UWord32 currentTimeMS); + const WebRtc_Word64 currentTimeMS); - WebRtc_UWord32 lastTimeReceived; + WebRtc_Word64 lastTimeReceived; // FIR - WebRtc_Word32 lastFIRSequenceNumber; - WebRtc_UWord32 lastFIRRequest; + WebRtc_Word32 lastFIRSequenceNumber; + WebRtc_Word64 lastFIRRequest; // TMMBN TMMBRSet TmmbnBoundingSet; @@ -118,7 +119,7 @@ public: bool readyForDelete; private: - WebRtc_UWord32* _tmmbrSetTimeouts; + std::vector _tmmbrSetTimeouts; }; } // end namespace RTCPHelp diff --git a/src/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/src/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc index 0e94e6409d..2cb6d25f0e 100644 --- a/src/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc +++ b/src/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc @@ -130,7 +130,7 @@ class FakeSystemClock : public RtpRtcpClock { FakeSystemClock() : time_in_ms_(1335900000) {} // A nonzero, but fake, value. - virtual WebRtc_UWord32 GetTimeInMS() { + virtual WebRtc_Word64 GetTimeInMS() { return time_in_ms_; } @@ -146,7 +146,7 @@ class FakeSystemClock : public RtpRtcpClock { time_in_ms_ += ms_to_advance; } private: - WebRtc_UWord32 time_in_ms_; + WebRtc_Word64 time_in_ms_; }; diff --git a/src/modules/rtp_rtcp/source/rtcp_sender.cc b/src/modules/rtp_rtcp/source/rtcp_sender.cc index eb3a905d99..887c6d7513 100644 --- a/src/modules/rtp_rtcp/source/rtcp_sender.cc +++ b/src/modules/rtp_rtcp/source/rtcp_sender.cc @@ -431,7 +431,7 @@ From RFC 3550 a value of the RTCP bandwidth below the intended average */ - WebRtc_UWord32 now = _clock.GetTimeInMS(); + WebRtc_Word64 now = _clock.GetTimeInMS(); CriticalSectionScoped lock(_criticalSectionRTCPSender); diff --git a/src/modules/rtp_rtcp/source/rtcp_sender.h b/src/modules/rtp_rtcp/source/rtcp_sender.h index e31ca0715e..14719587ce 100644 --- a/src/modules/rtp_rtcp/source/rtcp_sender.h +++ b/src/modules/rtp_rtcp/source/rtcp_sender.h @@ -198,7 +198,7 @@ private: bool _TMMBR; bool _IJ; - WebRtc_UWord32 _nextTimeToSendRTCP; + WebRtc_Word64 _nextTimeToSendRTCP; WebRtc_UWord32 _SSRC; WebRtc_UWord32 _remoteSSRC; // SSRC that we receive on our RTP channel diff --git a/src/modules/rtp_rtcp/source/rtp_packet_history.cc b/src/modules/rtp_rtcp/source/rtp_packet_history.cc index 0de75532db..b3a93e53a8 100644 --- a/src/modules/rtp_rtcp/source/rtp_packet_history.cc +++ b/src/modules/rtp_rtcp/source/rtp_packet_history.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -8,10 +8,6 @@ * be found in the AUTHORS file in the root of the source tree. */ -/* - * Class for storing RTP packets. - */ - #include "rtp_packet_history.h" #include @@ -206,7 +202,7 @@ bool RTPPacketHistory::GetRTPPacket(uint16_t sequence_number, } // Verify elapsed time since last retrieve. - uint32_t now = clock_.GetTimeInMS(); + int64_t now = clock_.GetTimeInMS(); if (min_elapsed_time_ms > 0 && ((now - stored_resend_times_.at(index)) < min_elapsed_time_ms)) { WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1, diff --git a/src/modules/rtp_rtcp/source/rtp_packet_history.h b/src/modules/rtp_rtcp/source/rtp_packet_history.h index c61fd0b0e7..581bffb831 100644 --- a/src/modules/rtp_rtcp/source/rtp_packet_history.h +++ b/src/modules/rtp_rtcp/source/rtp_packet_history.h @@ -1,15 +1,13 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. - */ - -/* - * Class for storing RTP packets. + * + * Class for storing RTP packets. */ #ifndef WEBRTC_MODULES_RTP_RTCP_RTP_PACKET_HISTORY_H_ @@ -79,8 +77,8 @@ class RTPPacketHistory { std::vector > stored_packets_; std::vector stored_seq_nums_; std::vector stored_lengths_; - std::vector stored_times_; - std::vector stored_resend_times_; + std::vector stored_times_; + std::vector stored_resend_times_; std::vector stored_types_; }; } // namespace webrtc diff --git a/src/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc b/src/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc index c849bc293d..1bf55ed893 100644 --- a/src/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc +++ b/src/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc @@ -1,14 +1,12 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. - */ - -/* + * * This file includes unit tests for the RTPPacketHistory. */ @@ -27,7 +25,7 @@ class FakeClock : public RtpRtcpClock { } // Return a timestamp in milliseconds relative to some arbitrary // source; the source is fixed for this clock. - virtual WebRtc_UWord32 GetTimeInMS() { + virtual WebRtc_Word64 GetTimeInMS() { return time_in_ms_; } // Retrieve an NTP absolute timestamp. @@ -39,7 +37,7 @@ class FakeClock : public RtpRtcpClock { time_in_ms_ += time_increment_ms; } private: - WebRtc_UWord32 time_in_ms_; + WebRtc_Word64 time_in_ms_; }; class RtpPacketHistoryTest : public ::testing::Test { @@ -189,7 +187,7 @@ TEST_F(RtpPacketHistoryTest, DontRetransmit) { TEST_F(RtpPacketHistoryTest, MinResendTime) { hist_->SetStorePacketsStatus(true, 10); - WebRtc_UWord32 store_time = fake_clock_.GetTimeInMS(); + WebRtc_Word64 store_time = fake_clock_.GetTimeInMS(); uint16_t len = 0; CreateRtpPacket(kSeqNum, kSsrc, kPayload, kTimestamp, packet_, &len); EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, kMaxPacketLength, diff --git a/src/modules/rtp_rtcp/source/rtp_receiver.cc b/src/modules/rtp_rtcp/source/rtp_receiver.cc index 6d927a55d8..1887fc3c4c 100644 --- a/src/modules/rtp_rtcp/source/rtp_receiver.cc +++ b/src/modules/rtp_rtcp/source/rtp_receiver.cc @@ -174,7 +174,7 @@ void RTPReceiver::PacketTimeout() return; } - WebRtc_UWord32 now = _clock.GetTimeInMS(); + WebRtc_Word64 now = _clock.GetTimeInMS(); if(now - _lastReceiveTime > _packetTimeOutMS) { @@ -192,7 +192,7 @@ void RTPReceiver::PacketTimeout() } void -RTPReceiver::ProcessDeadOrAlive(const bool RTCPalive, const WebRtc_UWord32 now) +RTPReceiver::ProcessDeadOrAlive(const bool RTCPalive, const WebRtc_Word64 now) { if(_cbRtpFeedback == NULL) { @@ -918,7 +918,7 @@ bool RTPReceiver::RetransmitOfOldPacket( if (_audio) { frequencyKHz = AudioFrequency() / 1000; } - WebRtc_UWord32 timeDiffMS = _clock.GetTimeInMS() - _lastReceiveTime; + WebRtc_Word64 timeDiffMS = _clock.GetTimeInMS() - _lastReceiveTime; // Diff in time stamp since last received in order. WebRtc_Word32 rtpTimeStampDiffMS = static_cast( rtpTimeStamp - _lastReceivedTimestamp) / frequencyKHz; @@ -941,8 +941,7 @@ bool RTPReceiver::RetransmitOfOldPacket( } else { maxDelayMs = (minRTT / 3) + 1; } - if (static_cast(timeDiffMS) > - rtpTimeStampDiffMS + maxDelayMs) { + if (timeDiffMS > rtpTimeStampDiffMS + maxDelayMs) { return true; } return false; diff --git a/src/modules/rtp_rtcp/source/rtp_receiver.h b/src/modules/rtp_rtcp/source/rtp_receiver.h index e8bd7f364b..1ee824bf63 100644 --- a/src/modules/rtp_rtcp/source/rtp_receiver.h +++ b/src/modules/rtp_rtcp/source/rtp_receiver.h @@ -46,7 +46,7 @@ public: WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 timeoutMS); void PacketTimeout(); - void ProcessDeadOrAlive(const bool RTCPalive, const WebRtc_UWord32 now); + void ProcessDeadOrAlive(const bool RTCPalive, const WebRtc_Word64 now); void ProcessBitrate(); @@ -191,21 +191,20 @@ private: const bool _audio; ModuleRtpRtcpImpl& _rtpRtcp; - CriticalSectionWrapper* _criticalSectionCbs; - RtpFeedback* _cbRtpFeedback; - RtpData* _cbRtpData; + CriticalSectionWrapper* _criticalSectionCbs; + RtpFeedback* _cbRtpFeedback; + RtpData* _cbRtpData; - CriticalSectionWrapper* _criticalSectionRTPReceiver; - mutable WebRtc_UWord32 _lastReceiveTime; - WebRtc_UWord16 _lastReceivedPayloadLength; - WebRtc_Word8 _lastReceivedPayloadType; - WebRtc_Word8 _lastReceivedMediaPayloadType; + CriticalSectionWrapper* _criticalSectionRTPReceiver; + mutable WebRtc_Word64 _lastReceiveTime; + WebRtc_UWord16 _lastReceivedPayloadLength; + WebRtc_Word8 _lastReceivedPayloadType; + WebRtc_Word8 _lastReceivedMediaPayloadType; ModuleRTPUtility::AudioPayload _lastReceivedAudioSpecific; ModuleRTPUtility::VideoPayload _lastReceivedVideoSpecific; WebRtc_UWord32 _packetTimeOutMS; - WebRtc_Word8 _redPayloadType; std::map _payloadTypeMap; diff --git a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index a90992af37..b2851a7acb 100644 --- a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -173,14 +173,14 @@ void ModuleRtpRtcpImpl::DeRegisterChildModule(RtpRtcp* removeModule) { // returns the number of milliseconds until the module want a worker thread // to call Process WebRtc_Word32 ModuleRtpRtcpImpl::TimeUntilNextProcess() { - const WebRtc_UWord32 now = _clock.GetTimeInMS(); + const WebRtc_Word64 now = _clock.GetTimeInMS(); return kRtpRtcpMaxIdleTimeProcess - (now - _lastProcessTime); } // Process any pending tasks such as timeouts // non time critical events WebRtc_Word32 ModuleRtpRtcpImpl::Process() { - const WebRtc_UWord32 now = _clock.GetTimeInMS(); + const WebRtc_Word64 now = _clock.GetTimeInMS(); _lastProcessTime = now; _rtpSender.ProcessSendToNetwork(); @@ -250,7 +250,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::Process() { void ModuleRtpRtcpImpl::ProcessDeadOrAliveTimer() { if (_deadOrAliveActive) { - const WebRtc_UWord32 now = _clock.GetTimeInMS(); + const WebRtc_Word64 now = _clock.GetTimeInMS(); if (now > _deadOrAliveTimeoutMS + _deadOrAliveLastTimer) { // RTCP is alive if we have received a report the last 12 seconds _deadOrAliveLastTimer += _deadOrAliveTimeoutMS; @@ -1429,12 +1429,12 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SendNACK(const WebRtc_UWord16* nackList, WebRtc_UWord16 avgRTT = 0; _rtcpReceiver.RTT(_rtpReceiver.SSRC(), NULL, &avgRTT, NULL, NULL); - WebRtc_UWord32 waitTime = 5 + ((avgRTT * 3) >> 1); // 5 + RTT*1.5 + WebRtc_Word64 waitTime = 5 + ((avgRTT * 3) >> 1); // 5 + RTT*1.5 if (waitTime == 5) { - waitTime = 100; //During startup we don't have an RTT + waitTime = 100; // During startup we don't have an RTT } - const WebRtc_UWord32 now = _clock.GetTimeInMS(); - const WebRtc_UWord32 timeLimit = now - waitTime; + const WebRtc_Word64 now = _clock.GetTimeInMS(); + const WebRtc_Word64 timeLimit = now - waitTime; if (_nackLastTimeSent < timeLimit) { // send list diff --git a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h index fbabb1b98e..ece25d15ba 100644 --- a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -481,9 +481,9 @@ private: WebRtc_Word32 _id; const bool _audio; bool _collisionDetected; - WebRtc_UWord32 _lastProcessTime; - WebRtc_UWord32 _lastBitrateProcessTime; - WebRtc_UWord32 _lastPacketTimeoutProcessTime; + WebRtc_Word64 _lastProcessTime; + WebRtc_Word64 _lastBitrateProcessTime; + WebRtc_Word64 _lastPacketTimeoutProcessTime; WebRtc_UWord16 _packetOverHead; scoped_ptr _criticalSectionModulePtrs; @@ -494,7 +494,7 @@ private: // Dead or alive bool _deadOrAliveActive; WebRtc_UWord32 _deadOrAliveTimeoutMS; - WebRtc_UWord32 _deadOrAliveLastTimer; + WebRtc_Word64 _deadOrAliveLastTimer; // send side NACKMethod _nackMethod; WebRtc_UWord32 _nackLastTimeSent; diff --git a/src/modules/rtp_rtcp/source/rtp_sender.cc b/src/modules/rtp_rtcp/source/rtp_sender.cc index a4758cd4f0..c122e52de3 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender.cc +++ b/src/modules/rtp_rtcp/source/rtp_sender.cc @@ -718,7 +718,7 @@ void RTPSender::OnReceivedNACK(const WebRtc_UWord16 nackSequenceNumbersLength, const WebRtc_UWord16* nackSequenceNumbers, const WebRtc_UWord16 avgRTT) { - const WebRtc_UWord32 now = _clock.GetTimeInMS(); + const WebRtc_Word64 now = _clock.GetTimeInMS(); WebRtc_UWord32 bytesReSent = 0; // Enough bandwidth to send NACK? @@ -826,14 +826,14 @@ void RTPSender::UpdateNACKBitRate(const WebRtc_UWord32 bytes, // Function triggered by timer. void RTPSender::ProcessSendToNetwork() { - WebRtc_UWord32 delta_time_ms; + WebRtc_Word64 delta_time_ms; { CriticalSectionScoped cs(_sendCritsect); if (!_transmissionSmoothing) { return; } - WebRtc_UWord32 now = _clock.GetTimeInMS(); + WebRtc_Word64 now = _clock.GetTimeInMS(); delta_time_ms = now - _timeLastSendToNetworkUpdate; _timeLastSendToNetworkUpdate = now; } @@ -858,7 +858,7 @@ void RTPSender::ProcessSendToNetwork() { } assert(length > 0); - WebRtc_UWord32 diff_ms = _clock.GetTimeInMS() - stored_time_ms; + WebRtc_Word64 diff_ms = _clock.GetTimeInMS() - stored_time_ms; ModuleRTPUtility::RTPHeaderParser rtpParser(data_buffer, length); WebRtcRTPHeader rtp_header; @@ -1155,7 +1155,7 @@ void RTPSender::UpdateTransmissionTimeOffset( WebRtc_UWord8* rtp_packet, const WebRtc_UWord16 rtp_packet_length, const WebRtcRTPHeader& rtp_header, - const WebRtc_UWord32 time_ms) const { + const WebRtc_Word64 time_ms) const { CriticalSectionScoped cs(_sendCritsect); // Get length until start of transmission block. diff --git a/src/modules/rtp_rtcp/source/rtp_sender.h b/src/modules/rtp_rtcp/source/rtp_sender.h index a2037af839..963f5ccdca 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender.h +++ b/src/modules/rtp_rtcp/source/rtp_sender.h @@ -163,7 +163,7 @@ public: void UpdateTransmissionTimeOffset(WebRtc_UWord8* rtp_packet, const WebRtc_UWord16 rtp_packet_length, const WebRtcRTPHeader& rtp_header, - const WebRtc_UWord32 time_ms) const; + const WebRtc_Word64 time_ms) const; void SetTransmissionSmoothingStatus(const bool enable); @@ -321,7 +321,7 @@ private: RTPPacketHistory* _packetHistory; TransmissionBucket _sendBucket; - WebRtc_UWord32 _timeLastSendToNetworkUpdate; + WebRtc_Word64 _timeLastSendToNetworkUpdate; bool _transmissionSmoothing; // statistics diff --git a/src/modules/rtp_rtcp/source/rtp_sender_audio.cc b/src/modules/rtp_rtcp/source/rtp_sender_audio.cc index 361aea591e..76738caa85 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender_audio.cc +++ b/src/modules/rtp_rtcp/source/rtp_sender_audio.cc @@ -203,7 +203,7 @@ RTPSenderAudio::SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const telephoneEvent = _dtmfKey; return true; } - WebRtc_UWord32 delaySinceLastDTMF = (_clock.GetTimeInMS() - _dtmfTimeLastSent); + WebRtc_Word64 delaySinceLastDTMF = _clock.GetTimeInMS() - _dtmfTimeLastSent; if(delaySinceLastDTMF < 100) { telephoneEvent = _dtmfKey; @@ -231,8 +231,7 @@ WebRtc_Word32 RTPSenderAudio::SendAudio( if (!_dtmfEventIsOn && PendingDTMF()) { CriticalSectionScoped cs(_sendAudioCritsect); - WebRtc_UWord32 delaySinceLastDTMF = _clock.GetTimeInMS() - - _dtmfTimeLastSent; + WebRtc_Word64 delaySinceLastDTMF = _clock.GetTimeInMS() - _dtmfTimeLastSent; if (delaySinceLastDTMF > 100) { // New tone to play diff --git a/src/modules/rtp_rtcp/source/rtp_sender_audio.h b/src/modules/rtp_rtcp/source/rtp_sender_audio.h index 1ea2fab7ca..5974441ba8 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender_audio.h +++ b/src/modules/rtp_rtcp/source/rtp_sender_audio.h @@ -100,20 +100,20 @@ private: WebRtc_UWord16 _packetSizeSamples; // DTMF - bool _dtmfEventIsOn; - bool _dtmfEventFirstPacketSent; + bool _dtmfEventIsOn; + bool _dtmfEventFirstPacketSent; WebRtc_Word8 _dtmfPayloadType; WebRtc_UWord32 _dtmfTimestamp; WebRtc_UWord8 _dtmfKey; WebRtc_UWord32 _dtmfLengthSamples; WebRtc_UWord8 _dtmfLevel; - WebRtc_UWord32 _dtmfTimeLastSent; + WebRtc_Word64 _dtmfTimeLastSent; WebRtc_UWord32 _dtmfTimestampLastSent; WebRtc_Word8 _REDPayloadType; // VAD detection, used for markerbit - bool _inbandVADactive; + bool _inbandVADactive; WebRtc_Word8 _cngNBPayloadType; WebRtc_Word8 _cngWBPayloadType; WebRtc_Word8 _cngSWBPayloadType; diff --git a/src/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/src/modules/rtp_rtcp/source/rtp_sender_unittest.cc index 436a3f5aba..113e65bce7 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender_unittest.cc +++ b/src/modules/rtp_rtcp/source/rtp_sender_unittest.cc @@ -39,7 +39,7 @@ class FakeClockTest : public RtpRtcpClock { } // Return a timestamp in milliseconds relative to some arbitrary // source; the source is fixed for this clock. - virtual WebRtc_UWord32 GetTimeInMS() { + virtual WebRtc_Word64 GetTimeInMS() { return time_in_ms_; } // Retrieve an NTP absolute timestamp. @@ -51,7 +51,7 @@ class FakeClockTest : public RtpRtcpClock { time_in_ms_ += time_increment_ms; } private: - WebRtc_UWord32 time_in_ms_; + WebRtc_Word64 time_in_ms_; }; class LoopbackTransportTest : public webrtc::Transport { diff --git a/src/modules/rtp_rtcp/source/rtp_utility.cc b/src/modules/rtp_rtcp/source/rtp_utility.cc index 796712d4e9..5123278b3e 100644 --- a/src/modules/rtp_rtcp/source/rtp_utility.cc +++ b/src/modules/rtp_rtcp/source/rtp_utility.cc @@ -26,7 +26,8 @@ #include #endif -#include "trace.h" +#include "system_wrappers/interface/tick_util.h" +#include "system_wrappers/interface/trace.h" #if (defined(_DEBUG) && defined(_WIN32) && (_MSC_VER >= 1400)) #define DEBUG_PRINT(...) \ @@ -147,7 +148,7 @@ void get_time(WindowsHelpTimer* help_timer, FILETIME& current_time) { virtual ~WindowsSystemClock() {} - virtual WebRtc_UWord32 GetTimeInMS(); + virtual WebRtc_Word64 GetTimeInMS(); virtual void CurrentNTP(WebRtc_UWord32& secs, WebRtc_UWord32& frac); @@ -163,15 +164,15 @@ public: UnixSystemClock() {} virtual ~UnixSystemClock() {} - virtual WebRtc_UWord32 GetTimeInMS(); + virtual WebRtc_Word64 GetTimeInMS(); virtual void CurrentNTP(WebRtc_UWord32& secs, WebRtc_UWord32& frac); }; #endif #if defined(_WIN32) -WebRtc_UWord32 WindowsSystemClock::GetTimeInMS() { - return timeGetTime(); +WebRtc_Word64 WindowsSystemClock::GetTimeInMS() { + return TickTime::MillisecondTimestamp(); } // Use the system time (roughly synchronised to the tick, and @@ -215,14 +216,8 @@ void WindowsSystemClock::CurrentNTP(WebRtc_UWord32& secs, #elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC)) -WebRtc_UWord32 UnixSystemClock::GetTimeInMS() { - struct timeval tv; - struct timezone tz; - WebRtc_UWord32 val; - - gettimeofday(&tv, &tz); - val = (WebRtc_UWord32)(tv.tv_sec * 1000 + tv.tv_usec / 1000); - return val; +WebRtc_Word64 UnixSystemClock::GetTimeInMS() { + return TickTime::MillisecondTimestamp(); } // Use the system time. diff --git a/src/modules/rtp_rtcp/test/testAPI/test_api.h b/src/modules/rtp_rtcp/test/testAPI/test_api.h index ed9d75a05e..6261d7f130 100644 --- a/src/modules/rtp_rtcp/test/testAPI/test_api.h +++ b/src/modules/rtp_rtcp/test/testAPI/test_api.h @@ -21,7 +21,7 @@ class FakeRtpRtcpClock : public RtpRtcpClock { } // Return a timestamp in milliseconds relative to some arbitrary // source; the source is fixed for this clock. - virtual WebRtc_UWord32 GetTimeInMS() { + virtual WebRtc_Word64 GetTimeInMS() { return time_in_ms_; } // Retrieve an NTP absolute timestamp. @@ -33,7 +33,7 @@ class FakeRtpRtcpClock : public RtpRtcpClock { time_in_ms_ += time_increment_ms; } private: - WebRtc_UWord32 time_in_ms_; + WebRtc_Word64 time_in_ms_; }; // This class sends all its packet straight to the provided RtpRtcp module.