Use int64_t more consistently for times, in particular for RTT values.
Existing code was inconsistent about whether to use uint16_t, int, unsigned int, or uint32_t, and sometimes silently truncated one to another, or truncated int64_t. Because most core time-handling functions use int64_t, being consistent about using int64_t unless otherwise necessary minimizes the number of explicit or implicit casts. BUG=chromium:81439 TEST=none R=henrik.lundin@webrtc.org, holmer@google.com, tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/31349004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@8045 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -41,7 +41,7 @@ class StreamStatistician {
|
||||
// Returns true if the packet with RTP header |header| is likely to be a
|
||||
// retransmitted packet, false otherwise.
|
||||
virtual bool IsRetransmitOfOldPacket(const RTPHeader& header,
|
||||
int min_rtt) const = 0;
|
||||
int64_t min_rtt) const = 0;
|
||||
|
||||
// Returns true if |sequence_number| is received in order, false otherwise.
|
||||
virtual bool IsPacketInOrder(uint16_t sequence_number) const = 0;
|
||||
|
||||
@ -31,7 +31,7 @@ class RemoteNtpTimeEstimator {
|
||||
|
||||
// Updates the estimator with round trip time |rtt|, NTP seconds |ntp_secs|,
|
||||
// NTP fraction |ntp_frac| and RTP timestamp |rtcp_timestamp|.
|
||||
bool UpdateRtcpTimestamp(uint16_t rtt, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
bool UpdateRtcpTimestamp(int64_t rtt, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
uint32_t rtp_timestamp);
|
||||
|
||||
// Estimates the NTP timestamp in local timebase from |rtp_timestamp|.
|
||||
|
||||
@ -376,10 +376,10 @@ class RtpRtcp : public Module {
|
||||
* return -1 on failure else 0
|
||||
*/
|
||||
virtual int32_t RTT(uint32_t remoteSSRC,
|
||||
uint16_t* RTT,
|
||||
uint16_t* avgRTT,
|
||||
uint16_t* minRTT,
|
||||
uint16_t* maxRTT) const = 0;
|
||||
int64_t* RTT,
|
||||
int64_t* avgRTT,
|
||||
int64_t* minRTT,
|
||||
int64_t* maxRTT) const = 0;
|
||||
|
||||
/*
|
||||
* Force a send of a RTCP packet
|
||||
|
||||
@ -287,7 +287,7 @@ class RtcpBandwidthObserver {
|
||||
|
||||
virtual void OnReceivedRtcpReceiverReport(
|
||||
const ReportBlockList& report_blocks,
|
||||
uint16_t rtt,
|
||||
int64_t rtt,
|
||||
int64_t now_ms) = 0;
|
||||
|
||||
virtual ~RtcpBandwidthObserver() {}
|
||||
@ -295,9 +295,9 @@ class RtcpBandwidthObserver {
|
||||
|
||||
class RtcpRttStats {
|
||||
public:
|
||||
virtual void OnRttUpdate(uint32_t rtt) = 0;
|
||||
virtual void OnRttUpdate(int64_t rtt) = 0;
|
||||
|
||||
virtual uint32_t LastProcessedRtt() const = 0;
|
||||
virtual int64_t LastProcessedRtt() const = 0;
|
||||
|
||||
virtual ~RtcpRttStats() {};
|
||||
};
|
||||
|
||||
@ -155,7 +155,11 @@ class MockRtpRtcp : public RtpRtcp {
|
||||
MOCK_METHOD1(RemoveMixedCNAME,
|
||||
int32_t(const uint32_t SSRC));
|
||||
MOCK_CONST_METHOD5(RTT,
|
||||
int32_t(const uint32_t remoteSSRC, uint16_t* RTT, uint16_t* avgRTT, uint16_t* minRTT, uint16_t* maxRTT));
|
||||
int32_t(const uint32_t remoteSSRC,
|
||||
int64_t* RTT,
|
||||
int64_t* avgRTT,
|
||||
int64_t* minRTT,
|
||||
int64_t* maxRTT));
|
||||
MOCK_METHOD1(SendRTCP,
|
||||
int32_t(uint32_t rtcpPacketType));
|
||||
MOCK_METHOD1(SendRTCPReferencePictureSelection,
|
||||
|
||||
@ -345,7 +345,7 @@ void StreamStatisticianImpl::LastReceiveTimeNtp(uint32_t* secs,
|
||||
}
|
||||
|
||||
bool StreamStatisticianImpl::IsRetransmitOfOldPacket(
|
||||
const RTPHeader& header, int min_rtt) const {
|
||||
const RTPHeader& header, int64_t min_rtt) const {
|
||||
CriticalSectionScoped cs(stream_lock_.get());
|
||||
if (InOrderPacketInternal(header.sequenceNumber)) {
|
||||
return false;
|
||||
@ -358,17 +358,16 @@ bool StreamStatisticianImpl::IsRetransmitOfOldPacket(
|
||||
|
||||
// Diff in time stamp since last received in order.
|
||||
uint32_t timestamp_diff = header.timestamp - last_received_timestamp_;
|
||||
int32_t rtp_time_stamp_diff_ms = static_cast<int32_t>(timestamp_diff) /
|
||||
frequency_khz;
|
||||
uint32_t rtp_time_stamp_diff_ms = timestamp_diff / frequency_khz;
|
||||
|
||||
int32_t max_delay_ms = 0;
|
||||
int64_t max_delay_ms = 0;
|
||||
if (min_rtt == 0) {
|
||||
// Jitter standard deviation in samples.
|
||||
float jitter_std = sqrt(static_cast<float>(jitter_q4_ >> 4));
|
||||
|
||||
// 2 times the standard deviation => 95% confidence.
|
||||
// And transform to milliseconds by dividing by the frequency in kHz.
|
||||
max_delay_ms = static_cast<int32_t>((2 * jitter_std) / frequency_khz);
|
||||
max_delay_ms = static_cast<int64_t>((2 * jitter_std) / frequency_khz);
|
||||
|
||||
// Min max_delay_ms is 1.
|
||||
if (max_delay_ms == 0) {
|
||||
|
||||
@ -38,7 +38,7 @@ class StreamStatisticianImpl : public StreamStatistician {
|
||||
virtual uint32_t BitrateReceived() const OVERRIDE;
|
||||
virtual void ResetStatistics() OVERRIDE;
|
||||
virtual bool IsRetransmitOfOldPacket(const RTPHeader& header,
|
||||
int min_rtt) const OVERRIDE;
|
||||
int64_t min_rtt) const OVERRIDE;
|
||||
virtual bool IsPacketInOrder(uint16_t sequence_number) const OVERRIDE;
|
||||
|
||||
void IncomingPacket(const RTPHeader& rtp_header,
|
||||
|
||||
@ -28,7 +28,7 @@ RemoteNtpTimeEstimator::RemoteNtpTimeEstimator(Clock* clock)
|
||||
|
||||
RemoteNtpTimeEstimator::~RemoteNtpTimeEstimator() {}
|
||||
|
||||
bool RemoteNtpTimeEstimator::UpdateRtcpTimestamp(uint16_t rtt,
|
||||
bool RemoteNtpTimeEstimator::UpdateRtcpTimestamp(int64_t rtt,
|
||||
uint32_t ntp_secs,
|
||||
uint32_t ntp_frac,
|
||||
uint32_t rtcp_timestamp) {
|
||||
|
||||
@ -21,7 +21,7 @@ using ::testing::SetArgPointee;
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
static const int kTestRtt = 10;
|
||||
static const int64_t kTestRtt = 10;
|
||||
static const int64_t kLocalClockInitialTimeMs = 123;
|
||||
static const int64_t kRemoteClockInitialTimeMs = 345;
|
||||
static const uint32_t kTimestampOffset = 567;
|
||||
@ -54,14 +54,14 @@ class RemoteNtpTimeEstimatorTest : public ::testing::Test {
|
||||
ReceiveRtcpSr(kTestRtt, rtcp_timestamp, ntp_seconds, ntp_fractions);
|
||||
}
|
||||
|
||||
void UpdateRtcpTimestamp(uint16_t rtt, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
void UpdateRtcpTimestamp(int64_t rtt, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
uint32_t rtp_timestamp, bool expected_result) {
|
||||
EXPECT_EQ(expected_result,
|
||||
estimator_.UpdateRtcpTimestamp(rtt, ntp_secs, ntp_frac,
|
||||
rtp_timestamp));
|
||||
}
|
||||
|
||||
void ReceiveRtcpSr(uint16_t rtt,
|
||||
void ReceiveRtcpSr(int64_t rtt,
|
||||
uint32_t rtcp_timestamp,
|
||||
uint32_t ntp_seconds,
|
||||
uint32_t ntp_fractions) {
|
||||
|
||||
@ -163,10 +163,10 @@ void RTCPReceiver::SetSsrcs(uint32_t main_ssrc,
|
||||
}
|
||||
|
||||
int32_t RTCPReceiver::RTT(uint32_t remoteSSRC,
|
||||
uint16_t* RTT,
|
||||
uint16_t* avgRTT,
|
||||
uint16_t* minRTT,
|
||||
uint16_t* maxRTT) const {
|
||||
int64_t* RTT,
|
||||
int64_t* avgRTT,
|
||||
int64_t* minRTT,
|
||||
int64_t* maxRTT) const {
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
|
||||
|
||||
RTCPReportBlockInformation* reportBlock =
|
||||
@ -190,7 +190,7 @@ int32_t RTCPReceiver::RTT(uint32_t remoteSSRC,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool RTCPReceiver::GetAndResetXrRrRtt(uint16_t* rtt_ms) {
|
||||
bool RTCPReceiver::GetAndResetXrRrRtt(int64_t* rtt_ms) {
|
||||
assert(rtt_ms);
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
|
||||
if (xr_rr_rtt_ms_ == 0) {
|
||||
@ -480,7 +480,7 @@ void RTCPReceiver::HandleReportBlock(
|
||||
// To avoid problem with acquiring _criticalSectionRTCPSender while holding
|
||||
// _criticalSectionRTCPReceiver.
|
||||
_criticalSectionRTCPReceiver->Leave();
|
||||
uint32_t sendTimeMS =
|
||||
int64_t sendTimeMS =
|
||||
_rtpRtcp.SendTimeOfSendReport(rtcpPacket.ReportBlockItem.LastSR);
|
||||
_criticalSectionRTCPReceiver->Enter();
|
||||
|
||||
@ -526,15 +526,15 @@ void RTCPReceiver::HandleReportBlock(
|
||||
_clock->CurrentNtp(lastReceivedRRNTPsecs, lastReceivedRRNTPfrac);
|
||||
|
||||
// time when we received this in MS
|
||||
uint32_t receiveTimeMS = Clock::NtpToMs(lastReceivedRRNTPsecs,
|
||||
lastReceivedRRNTPfrac);
|
||||
int64_t receiveTimeMS = Clock::NtpToMs(lastReceivedRRNTPsecs,
|
||||
lastReceivedRRNTPfrac);
|
||||
|
||||
// Estimate RTT
|
||||
uint32_t d = (delaySinceLastSendReport & 0x0000ffff) * 1000;
|
||||
d /= 65536;
|
||||
d += ((delaySinceLastSendReport & 0xffff0000) >> 16) * 1000;
|
||||
|
||||
int32_t RTT = 0;
|
||||
int64_t RTT = 0;
|
||||
|
||||
if (sendTimeMS > 0) {
|
||||
RTT = receiveTimeMS - d - sendTimeMS;
|
||||
@ -543,27 +543,27 @@ void RTCPReceiver::HandleReportBlock(
|
||||
}
|
||||
if (RTT > reportBlock->maxRTT) {
|
||||
// store max RTT
|
||||
reportBlock->maxRTT = (uint16_t) RTT;
|
||||
reportBlock->maxRTT = RTT;
|
||||
}
|
||||
if (reportBlock->minRTT == 0) {
|
||||
// first RTT
|
||||
reportBlock->minRTT = (uint16_t) RTT;
|
||||
reportBlock->minRTT = RTT;
|
||||
} else if (RTT < reportBlock->minRTT) {
|
||||
// Store min RTT
|
||||
reportBlock->minRTT = (uint16_t) RTT;
|
||||
reportBlock->minRTT = RTT;
|
||||
}
|
||||
// store last RTT
|
||||
reportBlock->RTT = (uint16_t) RTT;
|
||||
reportBlock->RTT = RTT;
|
||||
|
||||
// store average RTT
|
||||
if (reportBlock->numAverageCalcs != 0) {
|
||||
float ac = static_cast<float> (reportBlock->numAverageCalcs);
|
||||
float newAverage = ((ac / (ac + 1)) * reportBlock->avgRTT)
|
||||
+ ((1 / (ac + 1)) * RTT);
|
||||
reportBlock->avgRTT = static_cast<int> (newAverage + 0.5f);
|
||||
float ac = static_cast<float>(reportBlock->numAverageCalcs);
|
||||
float newAverage =
|
||||
((ac / (ac + 1)) * reportBlock->avgRTT) + ((1 / (ac + 1)) * RTT);
|
||||
reportBlock->avgRTT = static_cast<int64_t>(newAverage + 0.5f);
|
||||
} else {
|
||||
// first RTT
|
||||
reportBlock->avgRTT = (uint16_t) RTT;
|
||||
reportBlock->avgRTT = RTT;
|
||||
}
|
||||
reportBlock->numAverageCalcs++;
|
||||
}
|
||||
@ -962,9 +962,9 @@ void RTCPReceiver::HandleXrDlrrReportBlockItem(
|
||||
(((packet.XRDLRRReportBlockItem.DelayLastRR & 0x0000ffff) * 1000) >> 16) +
|
||||
(((packet.XRDLRRReportBlockItem.DelayLastRR & 0xffff0000) >> 16) * 1000);
|
||||
|
||||
int32_t rtt = _clock->CurrentNtpInMilliseconds() - delay_rr_ms - send_time_ms;
|
||||
int64_t rtt = _clock->CurrentNtpInMilliseconds() - delay_rr_ms - send_time_ms;
|
||||
|
||||
xr_rr_rtt_ms_ = static_cast<uint16_t>(std::max(rtt, 1));
|
||||
xr_rr_rtt_ms_ = std::max<int64_t>(rtt, 1);
|
||||
|
||||
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpXrDlrrReportBlock;
|
||||
}
|
||||
|
||||
@ -71,14 +71,14 @@ public:
|
||||
|
||||
// get rtt
|
||||
int32_t RTT(uint32_t remoteSSRC,
|
||||
uint16_t* RTT,
|
||||
uint16_t* avgRTT,
|
||||
uint16_t* minRTT,
|
||||
uint16_t* maxRTT) const;
|
||||
int64_t* RTT,
|
||||
int64_t* avgRTT,
|
||||
int64_t* minRTT,
|
||||
int64_t* maxRTT) const;
|
||||
|
||||
int32_t SenderInfoReceived(RTCPSenderInfo* senderInfo) const;
|
||||
|
||||
bool GetAndResetXrRrRtt(uint16_t* rtt_ms);
|
||||
bool GetAndResetXrRrRtt(int64_t* rtt_ms);
|
||||
|
||||
// get statistics
|
||||
int32_t StatisticsReceived(
|
||||
@ -257,7 +257,7 @@ protected:
|
||||
uint32_t _lastReceivedXRNTPsecs;
|
||||
uint32_t _lastReceivedXRNTPfrac;
|
||||
// Estimated rtt, zero when there is no valid estimate.
|
||||
uint16_t xr_rr_rtt_ms_;
|
||||
int64_t xr_rr_rtt_ms_;
|
||||
|
||||
// Received report blocks.
|
||||
ReportBlockMap _receivedReportBlockMap
|
||||
|
||||
@ -34,11 +34,11 @@ public:
|
||||
uint32_t remoteMaxJitter;
|
||||
|
||||
// RTT
|
||||
uint16_t RTT;
|
||||
uint16_t minRTT;
|
||||
uint16_t maxRTT;
|
||||
uint16_t avgRTT;
|
||||
uint32_t numAverageCalcs;
|
||||
int64_t RTT;
|
||||
int64_t minRTT;
|
||||
int64_t maxRTT;
|
||||
int64_t avgRTT;
|
||||
uint32_t numAverageCalcs;
|
||||
};
|
||||
|
||||
class RTCPPacketInformation
|
||||
@ -68,7 +68,7 @@ public:
|
||||
uint16_t applicationLength;
|
||||
|
||||
ReportBlockList report_blocks;
|
||||
uint16_t rtt;
|
||||
int64_t rtt;
|
||||
|
||||
uint32_t interArrivalJitter;
|
||||
|
||||
|
||||
@ -744,7 +744,7 @@ TEST_F(RtcpReceiverTest, InjectXrPacketWithUnknownReportBlock) {
|
||||
}
|
||||
|
||||
TEST_F(RtcpReceiverTest, TestXrRrRttInitiallyFalse) {
|
||||
uint16_t rtt_ms;
|
||||
int64_t rtt_ms;
|
||||
EXPECT_FALSE(rtcp_receiver_->GetAndResetXrRrRtt(&rtt_ms));
|
||||
}
|
||||
|
||||
|
||||
@ -438,8 +438,7 @@ From RFC 3550
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
RTCPSender::LastSendReport( uint32_t& lastRTCPTime)
|
||||
uint32_t RTCPSender::LastSendReport(int64_t& lastRTCPTime)
|
||||
{
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||
|
||||
@ -447,7 +446,7 @@ RTCPSender::LastSendReport( uint32_t& lastRTCPTime)
|
||||
return _lastSendReport[0];
|
||||
}
|
||||
|
||||
uint32_t RTCPSender::SendTimeOfSendReport(uint32_t sendReport) {
|
||||
int64_t RTCPSender::SendTimeOfSendReport(uint32_t sendReport) {
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||
|
||||
// This is only saved when we are the sender
|
||||
|
||||
@ -103,13 +103,13 @@ public:
|
||||
|
||||
int32_t RemoveMixedCNAME(uint32_t SSRC);
|
||||
|
||||
uint32_t SendTimeOfSendReport(uint32_t sendReport);
|
||||
int64_t SendTimeOfSendReport(uint32_t sendReport);
|
||||
|
||||
bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const;
|
||||
|
||||
bool TimeToSendRTCPReport(bool sendKeyframeBeforeRTP = false) const;
|
||||
|
||||
uint32_t LastSendReport(uint32_t& lastRTCPTime);
|
||||
uint32_t LastSendReport(int64_t& lastRTCPTime);
|
||||
|
||||
int32_t SendRTCP(
|
||||
const FeedbackState& feedback_state,
|
||||
@ -310,7 +310,7 @@ private:
|
||||
// Sent
|
||||
uint32_t _lastSendReport[RTCP_NUMBER_OF_SR] GUARDED_BY(
|
||||
_criticalSectionRTCPSender); // allow packet loss and RTT above 1 sec
|
||||
uint32_t _lastRTCPTime[RTCP_NUMBER_OF_SR] GUARDED_BY(
|
||||
int64_t _lastRTCPTime[RTCP_NUMBER_OF_SR] GUARDED_BY(
|
||||
_criticalSectionRTCPSender);
|
||||
|
||||
// Sent XR receiver reference time report.
|
||||
|
||||
@ -178,7 +178,7 @@ bool RTPPacketHistory::HasRTPPacket(uint16_t sequence_number) const {
|
||||
}
|
||||
|
||||
bool RTPPacketHistory::GetPacketAndSetSendTime(uint16_t sequence_number,
|
||||
uint32_t min_elapsed_time_ms,
|
||||
int64_t min_elapsed_time_ms,
|
||||
bool retransmit,
|
||||
uint8_t* packet,
|
||||
size_t* packet_length,
|
||||
|
||||
@ -53,7 +53,7 @@ class RTPPacketHistory {
|
||||
// stored_time_ms: returns the time when the packet was stored.
|
||||
// type: returns the storage type set in PutRTPPacket.
|
||||
bool GetPacketAndSetSendTime(uint16_t sequence_number,
|
||||
uint32_t min_elapsed_time_ms,
|
||||
int64_t min_elapsed_time_ms,
|
||||
bool retransmit,
|
||||
uint8_t* packet,
|
||||
size_t* packet_length,
|
||||
|
||||
@ -181,10 +181,10 @@ int32_t ModuleRtpRtcpImpl::Process() {
|
||||
last_rtt_process_time_ && process_rtt) {
|
||||
std::vector<RTCPReportBlock> receive_blocks;
|
||||
rtcp_receiver_.StatisticsReceived(&receive_blocks);
|
||||
uint16_t max_rtt = 0;
|
||||
int64_t max_rtt = 0;
|
||||
for (std::vector<RTCPReportBlock>::iterator it = receive_blocks.begin();
|
||||
it != receive_blocks.end(); ++it) {
|
||||
uint16_t rtt = 0;
|
||||
int64_t rtt = 0;
|
||||
rtcp_receiver_.RTT(it->remoteSSRC, &rtt, NULL, NULL, NULL);
|
||||
max_rtt = (rtt > max_rtt) ? rtt : max_rtt;
|
||||
}
|
||||
@ -216,7 +216,7 @@ int32_t ModuleRtpRtcpImpl::Process() {
|
||||
} else {
|
||||
// Report rtt from receiver.
|
||||
if (process_rtt) {
|
||||
uint16_t rtt_ms;
|
||||
int64_t rtt_ms;
|
||||
if (rtt_stats_ && rtcp_receiver_.GetAndResetXrRrRtt(&rtt_ms)) {
|
||||
rtt_stats_->OnRttUpdate(rtt_ms);
|
||||
}
|
||||
@ -707,7 +707,7 @@ void ModuleRtpRtcpImpl::SetRTCPStatus(const RTCPMethod method) {
|
||||
|
||||
// Only for internal test.
|
||||
uint32_t ModuleRtpRtcpImpl::LastSendReport(
|
||||
uint32_t& last_rtcptime) {
|
||||
int64_t& last_rtcptime) {
|
||||
return rtcp_sender_.LastSendReport(last_rtcptime);
|
||||
}
|
||||
|
||||
@ -747,14 +747,14 @@ int32_t ModuleRtpRtcpImpl::RemoteNTP(
|
||||
|
||||
// Get RoundTripTime.
|
||||
int32_t ModuleRtpRtcpImpl::RTT(const uint32_t remote_ssrc,
|
||||
uint16_t* rtt,
|
||||
uint16_t* avg_rtt,
|
||||
uint16_t* min_rtt,
|
||||
uint16_t* max_rtt) const {
|
||||
int64_t* rtt,
|
||||
int64_t* avg_rtt,
|
||||
int64_t* min_rtt,
|
||||
int64_t* max_rtt) const {
|
||||
int32_t ret = rtcp_receiver_.RTT(remote_ssrc, rtt, avg_rtt, min_rtt, max_rtt);
|
||||
if (rtt && *rtt == 0) {
|
||||
// Try to get RTT from RtcpRttStats class.
|
||||
*rtt = static_cast<uint16_t>(rtt_ms());
|
||||
*rtt = rtt_ms();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -944,7 +944,7 @@ int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
|
||||
|
||||
bool ModuleRtpRtcpImpl::TimeToSendFullNackList(int64_t now) const {
|
||||
// Use RTT from RtcpRttStats class if provided.
|
||||
uint16_t rtt = rtt_ms();
|
||||
int64_t rtt = rtt_ms();
|
||||
if (rtt == 0) {
|
||||
rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ int32_t ModuleRtpRtcpImpl::SendRTCPReferencePictureSelection(
|
||||
GetFeedbackState(), kRtcpRpsi, 0, 0, false, picture_id);
|
||||
}
|
||||
|
||||
uint32_t ModuleRtpRtcpImpl::SendTimeOfSendReport(
|
||||
int64_t ModuleRtpRtcpImpl::SendTimeOfSendReport(
|
||||
const uint32_t send_report) {
|
||||
return rtcp_sender_.SendTimeOfSendReport(send_report);
|
||||
}
|
||||
@ -1261,7 +1261,7 @@ void ModuleRtpRtcpImpl::OnReceivedNACK(
|
||||
return;
|
||||
}
|
||||
// Use RTT from RtcpRttStats class if provided.
|
||||
uint16_t rtt = rtt_ms();
|
||||
int64_t rtt = rtt_ms();
|
||||
if (rtt == 0) {
|
||||
rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
|
||||
}
|
||||
@ -1324,12 +1324,12 @@ void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) {
|
||||
rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs);
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::set_rtt_ms(uint32_t rtt_ms) {
|
||||
void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) {
|
||||
CriticalSectionScoped cs(critical_section_rtt_.get());
|
||||
rtt_ms_ = rtt_ms;
|
||||
}
|
||||
|
||||
uint32_t ModuleRtpRtcpImpl::rtt_ms() const {
|
||||
int64_t ModuleRtpRtcpImpl::rtt_ms() const {
|
||||
CriticalSectionScoped cs(critical_section_rtt_.get());
|
||||
return rtt_ms_;
|
||||
}
|
||||
|
||||
@ -158,10 +158,10 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
|
||||
// Get RoundTripTime.
|
||||
virtual int32_t RTT(uint32_t remote_ssrc,
|
||||
uint16_t* rtt,
|
||||
uint16_t* avg_rtt,
|
||||
uint16_t* min_rtt,
|
||||
uint16_t* max_rtt) const OVERRIDE;
|
||||
int64_t* rtt,
|
||||
int64_t* avg_rtt,
|
||||
int64_t* min_rtt,
|
||||
int64_t* max_rtt) const OVERRIDE;
|
||||
|
||||
// Force a send of an RTCP packet.
|
||||
// Normal SR and RR are triggered via the process function.
|
||||
@ -326,7 +326,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
uint32_t* fec_rate,
|
||||
uint32_t* nackRate) const OVERRIDE;
|
||||
|
||||
uint32_t SendTimeOfSendReport(uint32_t send_report);
|
||||
int64_t SendTimeOfSendReport(uint32_t send_report);
|
||||
|
||||
bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const;
|
||||
|
||||
@ -367,7 +367,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
uint16_t RemoteSequenceNumber() const;
|
||||
|
||||
// Only for internal testing.
|
||||
uint32_t LastSendReport(uint32_t& last_rtcptime);
|
||||
uint32_t LastSendReport(int64_t& last_rtcptime);
|
||||
|
||||
RTPSender rtp_sender_;
|
||||
|
||||
@ -382,8 +382,8 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
int64_t RtcpReportInterval();
|
||||
void SetRtcpReceiverSsrcs(uint32_t main_ssrc);
|
||||
|
||||
void set_rtt_ms(uint32_t rtt_ms);
|
||||
uint32_t rtt_ms() const;
|
||||
void set_rtt_ms(int64_t rtt_ms);
|
||||
int64_t rtt_ms() const;
|
||||
|
||||
bool TimeToSendFullNackList(int64_t now) const;
|
||||
|
||||
@ -419,7 +419,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
|
||||
// The processed RTT from RtcpRttStats.
|
||||
scoped_ptr<CriticalSectionWrapper> critical_section_rtt_;
|
||||
uint32_t rtt_ms_;
|
||||
int64_t rtt_ms_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -31,7 +31,7 @@ namespace {
|
||||
const uint32_t kSenderSsrc = 0x12345;
|
||||
const uint32_t kReceiverSsrc = 0x23456;
|
||||
const uint32_t kSenderRtxSsrc = 0x32345;
|
||||
const uint32_t kOneWayNetworkDelayMs = 100;
|
||||
const int64_t kOneWayNetworkDelayMs = 100;
|
||||
const uint8_t kBaseLayerTid = 0;
|
||||
const uint8_t kHigherLayerTid = 1;
|
||||
const uint16_t kSequenceNumber = 100;
|
||||
@ -41,13 +41,13 @@ class RtcpRttStatsTestImpl : public RtcpRttStats {
|
||||
RtcpRttStatsTestImpl() : rtt_ms_(0) {}
|
||||
virtual ~RtcpRttStatsTestImpl() {}
|
||||
|
||||
virtual void OnRttUpdate(uint32_t rtt_ms) OVERRIDE {
|
||||
virtual void OnRttUpdate(int64_t rtt_ms) OVERRIDE {
|
||||
rtt_ms_ = rtt_ms;
|
||||
}
|
||||
virtual uint32_t LastProcessedRtt() const OVERRIDE {
|
||||
virtual int64_t LastProcessedRtt() const OVERRIDE {
|
||||
return rtt_ms_;
|
||||
}
|
||||
uint32_t rtt_ms_;
|
||||
int64_t rtt_ms_;
|
||||
};
|
||||
|
||||
class SendTransport : public Transport,
|
||||
@ -63,7 +63,7 @@ class SendTransport : public Transport,
|
||||
void SetRtpRtcpModule(ModuleRtpRtcpImpl* receiver) {
|
||||
receiver_ = receiver;
|
||||
}
|
||||
void SimulateNetworkDelay(uint32_t delay_ms, SimulatedClock* clock) {
|
||||
void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) {
|
||||
clock_ = clock;
|
||||
delay_ms_ = delay_ms;
|
||||
}
|
||||
@ -92,7 +92,7 @@ class SendTransport : public Transport,
|
||||
}
|
||||
ModuleRtpRtcpImpl* receiver_;
|
||||
SimulatedClock* clock_;
|
||||
uint32_t delay_ms_;
|
||||
int64_t delay_ms_;
|
||||
int rtp_packets_sent_;
|
||||
RTPHeader last_rtp_header_;
|
||||
std::vector<uint16_t> last_nack_list_;
|
||||
@ -277,10 +277,10 @@ TEST_F(RtpRtcpImplTest, Rtt) {
|
||||
EXPECT_EQ(0, receiver_.impl_->SendRTCP(kRtcpReport));
|
||||
|
||||
// Verify RTT.
|
||||
uint16_t rtt;
|
||||
uint16_t avg_rtt;
|
||||
uint16_t min_rtt;
|
||||
uint16_t max_rtt;
|
||||
int64_t rtt;
|
||||
int64_t avg_rtt;
|
||||
int64_t min_rtt;
|
||||
int64_t max_rtt;
|
||||
EXPECT_EQ(0,
|
||||
sender_.impl_->RTT(kReceiverSsrc, &rtt, &avg_rtt, &min_rtt, &max_rtt));
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, rtt);
|
||||
@ -293,8 +293,8 @@ TEST_F(RtpRtcpImplTest, Rtt) {
|
||||
sender_.impl_->RTT(kReceiverSsrc+1, &rtt, &avg_rtt, &min_rtt, &max_rtt));
|
||||
|
||||
// Verify RTT from rtt_stats config.
|
||||
EXPECT_EQ(0U, sender_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(0U, sender_.impl_->rtt_ms());
|
||||
EXPECT_EQ(0, sender_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(0, sender_.impl_->rtt_ms());
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, sender_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, sender_.impl_->rtt_ms());
|
||||
@ -317,8 +317,8 @@ TEST_F(RtpRtcpImplTest, RttForReceiverOnly) {
|
||||
EXPECT_EQ(0, sender_.impl_->SendRTCP(kRtcpReport));
|
||||
|
||||
// Verify RTT.
|
||||
EXPECT_EQ(0U, receiver_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(0U, receiver_.impl_->rtt_ms());
|
||||
EXPECT_EQ(0, receiver_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(0, receiver_.impl_->rtt_ms());
|
||||
receiver_.impl_->Process();
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.impl_->rtt_ms());
|
||||
|
||||
@ -653,7 +653,7 @@ bool RTPSender::StorePackets() const {
|
||||
return packet_history_.StorePackets();
|
||||
}
|
||||
|
||||
int32_t RTPSender::ReSendPacket(uint16_t packet_id, uint32_t min_resend_time) {
|
||||
int32_t RTPSender::ReSendPacket(uint16_t packet_id, int64_t min_resend_time) {
|
||||
size_t length = IP_PACKET_SIZE;
|
||||
uint8_t data_buffer[IP_PACKET_SIZE];
|
||||
int64_t capture_time_ms;
|
||||
@ -720,7 +720,7 @@ int RTPSender::SetSelectiveRetransmissions(uint8_t settings) {
|
||||
}
|
||||
|
||||
void RTPSender::OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers,
|
||||
uint16_t avg_rtt) {
|
||||
int64_t avg_rtt) {
|
||||
TRACE_EVENT2("webrtc_rtp", "RTPSender::OnReceivedNACK",
|
||||
"num_seqnum", nack_sequence_numbers.size(), "avg_rtt", avg_rtt);
|
||||
const int64_t now = clock_->TimeInMilliseconds();
|
||||
|
||||
@ -173,13 +173,13 @@ class RTPSender : public RTPSenderInterface {
|
||||
int SelectiveRetransmissions() const;
|
||||
int SetSelectiveRetransmissions(uint8_t settings);
|
||||
void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers,
|
||||
uint16_t avg_rtt);
|
||||
int64_t avg_rtt);
|
||||
|
||||
void SetStorePacketsStatus(bool enable, uint16_t number_to_store);
|
||||
|
||||
bool StorePackets() const;
|
||||
|
||||
int32_t ReSendPacket(uint16_t packet_id, uint32_t min_resend_time = 0);
|
||||
int32_t ReSendPacket(uint16_t packet_id, int64_t min_resend_time = 0);
|
||||
|
||||
bool ProcessNACKBitRate(uint32_t now);
|
||||
|
||||
|
||||
@ -319,10 +319,10 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
|
||||
EXPECT_EQ(test_sequence_number, stats.extended_max_sequence_number);
|
||||
EXPECT_EQ(reportBlockReceived.jitter, stats.jitter);
|
||||
|
||||
uint16_t RTT;
|
||||
uint16_t avgRTT;
|
||||
uint16_t minRTT;
|
||||
uint16_t maxRTT;
|
||||
int64_t RTT;
|
||||
int64_t avgRTT;
|
||||
int64_t minRTT;
|
||||
int64_t maxRTT;
|
||||
|
||||
// Get RoundTripTime.
|
||||
EXPECT_EQ(0, module1->RTT(test_ssrc + 1, &RTT, &avgRTT, &minRTT, &maxRTT));
|
||||
|
||||
Reference in New Issue
Block a user