replace NtpTime->Clock with Clock->NtpTime dependency
BUG=None Review-Url: https://codereview.webrtc.org/2393723004 Cr-Commit-Position: refs/heads/master@{#16519}
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/time_util.h"
|
||||
#include "webrtc/system_wrappers/include/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -78,7 +79,7 @@ void StreamStatisticianImpl::UpdateCounters(const RTPHeader& header,
|
||||
// are received, 4 will be ignored.
|
||||
if (in_order) {
|
||||
// Current time in samples.
|
||||
NtpTime receive_time(*clock_);
|
||||
NtpTime receive_time = clock_->CurrentNtpTime();
|
||||
|
||||
// Wrong if we use RetransmitOfOldPacket.
|
||||
if (receive_counters_.transmitted.packets > 1 &&
|
||||
|
||||
@ -260,7 +260,7 @@ bool RTCPReceiver::LastReceivedXrReferenceTimeInfo(
|
||||
|
||||
// Get the delay since last received report (RFC 3611).
|
||||
uint32_t receive_time_ntp = CompactNtp(last_received_xr_ntp_);
|
||||
uint32_t now_ntp = CompactNtp(NtpTime(*clock_));
|
||||
uint32_t now_ntp = CompactNtp(clock_->CurrentNtpTime());
|
||||
|
||||
info->delay_since_last_rr = now_ntp - receive_time_ntp;
|
||||
return true;
|
||||
@ -423,7 +423,7 @@ void RTCPReceiver::HandleSenderReport(const CommonHeader& rtcp_block,
|
||||
remote_sender_info_.sendPacketCount = sender_report.sender_packet_count();
|
||||
remote_sender_info_.sendOctetCount = sender_report.sender_octet_count();
|
||||
|
||||
last_received_sr_ntp_.SetCurrent(*clock_);
|
||||
last_received_sr_ntp_ = clock_->CurrentNtpTime();
|
||||
} else {
|
||||
// We will only store the send report from one source, but
|
||||
// we will store all the receive blocks.
|
||||
@ -504,7 +504,7 @@ void RTCPReceiver::HandleReportBlock(const ReportBlock& report_block,
|
||||
if (!receiver_only_ && send_time_ntp != 0) {
|
||||
uint32_t delay_ntp = report_block.delay_since_last_sr();
|
||||
// Local NTP time.
|
||||
uint32_t receive_time_ntp = CompactNtp(NtpTime(*clock_));
|
||||
uint32_t receive_time_ntp = CompactNtp(clock_->CurrentNtpTime());
|
||||
|
||||
// RTT in 1/(2^16) seconds.
|
||||
uint32_t rtt_ntp = receive_time_ntp - delay_ntp - send_time_ntp;
|
||||
@ -709,7 +709,7 @@ void RTCPReceiver::HandleXrReceiveReferenceTime(uint32_t sender_ssrc,
|
||||
const rtcp::Rrtr& rrtr) {
|
||||
remote_time_info_.ssrc = sender_ssrc;
|
||||
remote_time_info_.last_rr = CompactNtp(rrtr.ntp());
|
||||
last_received_xr_ntp_.SetCurrent(*clock_);
|
||||
last_received_xr_ntp_ = clock_->CurrentNtpTime();
|
||||
}
|
||||
|
||||
void RTCPReceiver::HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) {
|
||||
@ -728,7 +728,7 @@ void RTCPReceiver::HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) {
|
||||
return;
|
||||
|
||||
uint32_t delay_ntp = rti.delay_since_last_rr;
|
||||
uint32_t now_ntp = CompactNtp(NtpTime(*clock_));
|
||||
uint32_t now_ntp = CompactNtp(clock_->CurrentNtpTime());
|
||||
|
||||
uint32_t rtt_ntp = now_ntp - delay_ntp - send_time_ntp;
|
||||
xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp);
|
||||
|
||||
@ -271,7 +271,7 @@ TEST_F(RtcpReceiverTest, InjectSrPacketCalculatesRTT) {
|
||||
EXPECT_EQ(
|
||||
-1, rtcp_receiver_.RTT(kSenderSsrc, &rtt_ms, nullptr, nullptr, nullptr));
|
||||
|
||||
uint32_t sent_ntp = CompactNtp(NtpTime(system_clock_));
|
||||
uint32_t sent_ntp = CompactNtp(system_clock_.CurrentNtpTime());
|
||||
system_clock_.AdvanceTimeMilliseconds(kRttMs + kDelayMs);
|
||||
|
||||
rtcp::SenderReport sr;
|
||||
@ -301,7 +301,7 @@ TEST_F(RtcpReceiverTest, InjectSrPacketCalculatesNegativeRTTAsOne) {
|
||||
EXPECT_EQ(
|
||||
-1, rtcp_receiver_.RTT(kSenderSsrc, &rtt_ms, nullptr, nullptr, nullptr));
|
||||
|
||||
uint32_t sent_ntp = CompactNtp(NtpTime(system_clock_));
|
||||
uint32_t sent_ntp = CompactNtp(system_clock_.CurrentNtpTime());
|
||||
system_clock_.AdvanceTimeMilliseconds(kRttMs + kDelayMs);
|
||||
|
||||
rtcp::SenderReport sr;
|
||||
@ -774,7 +774,7 @@ TEST_F(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithSubBlock) {
|
||||
|
||||
InjectRtcpPacket(xr);
|
||||
|
||||
uint32_t compact_ntp_now = CompactNtp(NtpTime(system_clock_));
|
||||
uint32_t compact_ntp_now = CompactNtp(system_clock_.CurrentNtpTime());
|
||||
EXPECT_TRUE(rtcp_receiver_.GetAndResetXrRrRtt(&rtt_ms));
|
||||
uint32_t rtt_ntp = compact_ntp_now - kDelay - kLastRR;
|
||||
EXPECT_NEAR(CompactNtpRttToMs(rtt_ntp), rtt_ms, 1);
|
||||
@ -793,7 +793,7 @@ TEST_F(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithMultipleSubBlocks) {
|
||||
|
||||
InjectRtcpPacket(xr);
|
||||
|
||||
uint32_t compact_ntp_now = CompactNtp(NtpTime(system_clock_));
|
||||
uint32_t compact_ntp_now = CompactNtp(system_clock_.CurrentNtpTime());
|
||||
int64_t rtt_ms = 0;
|
||||
EXPECT_TRUE(rtcp_receiver_.GetAndResetXrRrRtt(&rtt_ms));
|
||||
uint32_t rtt_ntp = compact_ntp_now - kDelay - kLastRR;
|
||||
@ -859,7 +859,7 @@ TEST_F(RtcpReceiverTest, RttCalculatedAfterExtendedReportsDlrr) {
|
||||
const uint32_t kDelayNtp = rand.Rand(0, 0x7fffffff);
|
||||
const int64_t kDelayMs = CompactNtpRttToMs(kDelayNtp);
|
||||
rtcp_receiver_.SetRtcpXrRrtrStatus(true);
|
||||
NtpTime now(system_clock_);
|
||||
NtpTime now = system_clock_.CurrentNtpTime();
|
||||
uint32_t sent_ntp = CompactNtp(now);
|
||||
system_clock_.AdvanceTimeMilliseconds(kRttMs + kDelayMs);
|
||||
|
||||
@ -879,7 +879,7 @@ TEST_F(RtcpReceiverTest, XrDlrrCalculatesNegativeRttAsOne) {
|
||||
const int64_t kRttMs = rand.Rand(-3600 * 1000, -1);
|
||||
const uint32_t kDelayNtp = rand.Rand(0, 0x7fffffff);
|
||||
const int64_t kDelayMs = CompactNtpRttToMs(kDelayNtp);
|
||||
NtpTime now(system_clock_);
|
||||
NtpTime now = system_clock_.CurrentNtpTime();
|
||||
uint32_t sent_ntp = CompactNtp(now);
|
||||
system_clock_.AdvanceTimeMilliseconds(kRttMs + kDelayMs);
|
||||
rtcp_receiver_.SetRtcpXrRrtrStatus(true);
|
||||
|
||||
@ -779,7 +779,7 @@ int32_t RTCPSender::SendCompoundRTCP(
|
||||
|
||||
// We need to send our NTP even if we haven't received any reports.
|
||||
RtcpContext context(feedback_state, nack_size, nack_list, pictureID,
|
||||
NtpTime(*clock_));
|
||||
clock_->CurrentNtpTime());
|
||||
|
||||
PrepareReport(feedback_state);
|
||||
|
||||
|
||||
@ -22,11 +22,6 @@ inline uint32_t NtpToRtp(NtpTime ntp, uint32_t freq) {
|
||||
uint32_t tmp = (static_cast<uint64_t>(ntp.fractions()) * freq) >> 32;
|
||||
return ntp.seconds() * freq + tmp;
|
||||
}
|
||||
// Return the current RTP timestamp from the NTP timestamp
|
||||
// returned by the specified clock.
|
||||
inline uint32_t CurrentRtp(const Clock& clock, uint32_t freq) {
|
||||
return NtpToRtp(NtpTime(clock), freq);
|
||||
}
|
||||
|
||||
// Helper function for compact ntp representation:
|
||||
// RFC 3550, Section 4. Time Format.
|
||||
|
||||
Reference in New Issue
Block a user