Delete RtpRtcpInterface::RemoteNtp as redundant to GetSenderReportStats
Bug: None Change-Id: I8d5ed723ce29231f805e6819156a16ba275f8e3f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/295321 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39415}
This commit is contained in:
parent
85ea8a8025
commit
9f397217e1
@ -749,21 +749,18 @@ void ChannelReceive::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ntp_secs = 0;
|
absl::optional<RtpRtcpInterface::SenderReportStats> last_sr =
|
||||||
uint32_t ntp_frac = 0;
|
rtp_rtcp_->GetSenderReportStats();
|
||||||
uint32_t rtp_timestamp = 0;
|
if (!last_sr.has_value()) {
|
||||||
if (rtp_rtcp_->RemoteNTP(&ntp_secs, &ntp_frac,
|
|
||||||
/*rtcp_arrival_time_secs=*/nullptr,
|
|
||||||
/*rtcp_arrival_time_frac=*/nullptr,
|
|
||||||
&rtp_timestamp) != 0) {
|
|
||||||
// Waiting for RTCP.
|
// Waiting for RTCP.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
MutexLock lock(&ts_stats_lock_);
|
MutexLock lock(&ts_stats_lock_);
|
||||||
ntp_estimator_.UpdateRtcpTimestamp(
|
ntp_estimator_.UpdateRtcpTimestamp(TimeDelta::Millis(rtt),
|
||||||
TimeDelta::Millis(rtt), NtpTime(ntp_secs, ntp_frac), rtp_timestamp);
|
last_sr->last_remote_timestamp,
|
||||||
|
last_sr->last_remote_rtp_timestamp);
|
||||||
absl::optional<int64_t> remote_to_local_clock_offset =
|
absl::optional<int64_t> remote_to_local_clock_offset =
|
||||||
ntp_estimator_.EstimateRemoteToLocalClockOffset();
|
ntp_estimator_.EstimateRemoteToLocalClockOffset();
|
||||||
if (remote_to_local_clock_offset.has_value()) {
|
if (remote_to_local_clock_offset.has_value()) {
|
||||||
@ -1033,13 +1030,14 @@ absl::optional<Syncable::Info> ChannelReceive::GetSyncInfo() const {
|
|||||||
// these locks aren't needed.
|
// these locks aren't needed.
|
||||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||||
Syncable::Info info;
|
Syncable::Info info;
|
||||||
if (rtp_rtcp_->RemoteNTP(&info.capture_time_ntp_secs,
|
absl::optional<RtpRtcpInterface::SenderReportStats> last_sr =
|
||||||
&info.capture_time_ntp_frac,
|
rtp_rtcp_->GetSenderReportStats();
|
||||||
/*rtcp_arrival_time_secs=*/nullptr,
|
if (!last_sr.has_value()) {
|
||||||
/*rtcp_arrival_time_frac=*/nullptr,
|
|
||||||
&info.capture_time_source_clock) != 0) {
|
|
||||||
return absl::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
|
info.capture_time_ntp_secs = last_sr->last_remote_timestamp.seconds();
|
||||||
|
info.capture_time_ntp_frac = last_sr->last_remote_timestamp.fractions();
|
||||||
|
info.capture_time_source_clock = last_sr->last_remote_rtp_timestamp;
|
||||||
|
|
||||||
if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_ms_) {
|
if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_ms_) {
|
||||||
return absl::nullopt;
|
return absl::nullopt;
|
||||||
|
|||||||
@ -218,17 +218,18 @@ void AudioIngress::ReceivedRTCPPacket(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ntp_secs = 0, ntp_frac = 0, rtp_timestamp = 0;
|
absl::optional<RtpRtcpInterface::SenderReportStats> last_sr =
|
||||||
if (rtp_rtcp_->RemoteNTP(&ntp_secs, &ntp_frac, nullptr, nullptr,
|
rtp_rtcp_->GetSenderReportStats();
|
||||||
&rtp_timestamp) != 0) {
|
if (!last_sr.has_value()) {
|
||||||
// Waiting for RTCP.
|
// Waiting for RTCP.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
MutexLock lock(&lock_);
|
MutexLock lock(&lock_);
|
||||||
ntp_estimator_.UpdateRtcpTimestamp(
|
ntp_estimator_.UpdateRtcpTimestamp(TimeDelta::Millis(rtt),
|
||||||
TimeDelta::Millis(rtt), NtpTime(ntp_secs, ntp_frac), rtp_timestamp);
|
last_sr->last_remote_timestamp,
|
||||||
|
last_sr->last_remote_rtp_timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -117,14 +117,6 @@ class MockRtpRtcpInterface : public RtpRtcpInterface {
|
|||||||
MOCK_METHOD(RtcpMode, RTCP, (), (const, override));
|
MOCK_METHOD(RtcpMode, RTCP, (), (const, override));
|
||||||
MOCK_METHOD(void, SetRTCPStatus, (RtcpMode method), (override));
|
MOCK_METHOD(void, SetRTCPStatus, (RtcpMode method), (override));
|
||||||
MOCK_METHOD(int32_t, SetCNAME, (absl::string_view cname), (override));
|
MOCK_METHOD(int32_t, SetCNAME, (absl::string_view cname), (override));
|
||||||
MOCK_METHOD(int32_t,
|
|
||||||
RemoteNTP,
|
|
||||||
(uint32_t * received_ntp_secs,
|
|
||||||
uint32_t* received_ntp_frac,
|
|
||||||
uint32_t* rtcp_arrival_time_secs,
|
|
||||||
uint32_t* rtcp_arrival_time_frac,
|
|
||||||
uint32_t* rtcp_timestamp),
|
|
||||||
(const, override));
|
|
||||||
MOCK_METHOD(int32_t,
|
MOCK_METHOD(int32_t,
|
||||||
RTT,
|
RTT,
|
||||||
(uint32_t remote_ssrc,
|
(uint32_t remote_ssrc,
|
||||||
|
|||||||
@ -470,21 +470,6 @@ int32_t ModuleRtpRtcpImpl::SetCNAME(absl::string_view c_name) {
|
|||||||
return rtcp_sender_.SetCNAME(c_name);
|
return rtcp_sender_.SetCNAME(c_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::RemoteNTP(uint32_t* received_ntpsecs,
|
|
||||||
uint32_t* received_ntpfrac,
|
|
||||||
uint32_t* rtcp_arrival_time_secs,
|
|
||||||
uint32_t* rtcp_arrival_time_frac,
|
|
||||||
uint32_t* rtcp_timestamp) const {
|
|
||||||
return rtcp_receiver_.NTP(received_ntpsecs, received_ntpfrac,
|
|
||||||
rtcp_arrival_time_secs, rtcp_arrival_time_frac,
|
|
||||||
rtcp_timestamp,
|
|
||||||
/*remote_sender_packet_count=*/nullptr,
|
|
||||||
/*remote_sender_octet_count=*/nullptr,
|
|
||||||
/*remote_sender_reports_count=*/nullptr)
|
|
||||||
? 0
|
|
||||||
: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get RoundTripTime.
|
// Get RoundTripTime.
|
||||||
int32_t ModuleRtpRtcpImpl::RTT(const uint32_t remote_ssrc,
|
int32_t ModuleRtpRtcpImpl::RTT(const uint32_t remote_ssrc,
|
||||||
int64_t* rtt,
|
int64_t* rtt,
|
||||||
@ -541,7 +526,7 @@ ModuleRtpRtcpImpl::GetSenderReportStats() const {
|
|||||||
uint32_t arrival_timestamp_frac;
|
uint32_t arrival_timestamp_frac;
|
||||||
if (rtcp_receiver_.NTP(&remote_timestamp_secs, &remote_timestamp_frac,
|
if (rtcp_receiver_.NTP(&remote_timestamp_secs, &remote_timestamp_frac,
|
||||||
&arrival_timestamp_secs, &arrival_timestamp_frac,
|
&arrival_timestamp_secs, &arrival_timestamp_frac,
|
||||||
/*rtcp_timestamp=*/nullptr, &stats.packets_sent,
|
&stats.last_remote_rtp_timestamp, &stats.packets_sent,
|
||||||
&stats.bytes_sent, &stats.reports_count)) {
|
&stats.bytes_sent, &stats.reports_count)) {
|
||||||
stats.last_remote_timestamp.Set(remote_timestamp_secs,
|
stats.last_remote_timestamp.Set(remote_timestamp_secs,
|
||||||
remote_timestamp_frac);
|
remote_timestamp_frac);
|
||||||
|
|||||||
@ -167,13 +167,6 @@ class ABSL_DEPRECATED("") ModuleRtpRtcpImpl
|
|||||||
// Set RTCP CName.
|
// Set RTCP CName.
|
||||||
int32_t SetCNAME(absl::string_view c_name) override;
|
int32_t SetCNAME(absl::string_view c_name) override;
|
||||||
|
|
||||||
// Get remote NTP.
|
|
||||||
int32_t RemoteNTP(uint32_t* received_ntp_secs,
|
|
||||||
uint32_t* received_ntp_frac,
|
|
||||||
uint32_t* rtcp_arrival_time_secs,
|
|
||||||
uint32_t* rtcp_arrival_time_frac,
|
|
||||||
uint32_t* rtcp_timestamp) const override;
|
|
||||||
|
|
||||||
// Get RoundTripTime.
|
// Get RoundTripTime.
|
||||||
int32_t RTT(uint32_t remote_ssrc,
|
int32_t RTT(uint32_t remote_ssrc,
|
||||||
int64_t* rtt,
|
int64_t* rtt,
|
||||||
|
|||||||
@ -448,21 +448,6 @@ int32_t ModuleRtpRtcpImpl2::SetCNAME(absl::string_view c_name) {
|
|||||||
return rtcp_sender_.SetCNAME(c_name);
|
return rtcp_sender_.SetCNAME(c_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl2::RemoteNTP(uint32_t* received_ntpsecs,
|
|
||||||
uint32_t* received_ntpfrac,
|
|
||||||
uint32_t* rtcp_arrival_time_secs,
|
|
||||||
uint32_t* rtcp_arrival_time_frac,
|
|
||||||
uint32_t* rtcp_timestamp) const {
|
|
||||||
return rtcp_receiver_.NTP(received_ntpsecs, received_ntpfrac,
|
|
||||||
rtcp_arrival_time_secs, rtcp_arrival_time_frac,
|
|
||||||
rtcp_timestamp,
|
|
||||||
/*remote_sender_packet_count=*/nullptr,
|
|
||||||
/*remote_sender_octet_count=*/nullptr,
|
|
||||||
/*remote_sender_reports_count=*/nullptr)
|
|
||||||
? 0
|
|
||||||
: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(tommi): Check if `avg_rtt_ms`, `min_rtt_ms`, `max_rtt_ms` params are
|
// TODO(tommi): Check if `avg_rtt_ms`, `min_rtt_ms`, `max_rtt_ms` params are
|
||||||
// actually used in practice (some callers ask for it but don't use it). It
|
// actually used in practice (some callers ask for it but don't use it). It
|
||||||
// could be that only `rtt` is needed and if so, then the fast path could be to
|
// could be that only `rtt` is needed and if so, then the fast path could be to
|
||||||
@ -522,7 +507,7 @@ ModuleRtpRtcpImpl2::GetSenderReportStats() const {
|
|||||||
uint32_t arrival_timestamp_frac;
|
uint32_t arrival_timestamp_frac;
|
||||||
if (rtcp_receiver_.NTP(&remote_timestamp_secs, &remote_timestamp_frac,
|
if (rtcp_receiver_.NTP(&remote_timestamp_secs, &remote_timestamp_frac,
|
||||||
&arrival_timestamp_secs, &arrival_timestamp_frac,
|
&arrival_timestamp_secs, &arrival_timestamp_frac,
|
||||||
/*rtcp_timestamp=*/nullptr, &stats.packets_sent,
|
&stats.last_remote_rtp_timestamp, &stats.packets_sent,
|
||||||
&stats.bytes_sent, &stats.reports_count)) {
|
&stats.bytes_sent, &stats.reports_count)) {
|
||||||
stats.last_remote_timestamp.Set(remote_timestamp_secs,
|
stats.last_remote_timestamp.Set(remote_timestamp_secs,
|
||||||
remote_timestamp_frac);
|
remote_timestamp_frac);
|
||||||
|
|||||||
@ -179,13 +179,6 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
|
|||||||
// Set RTCP CName.
|
// Set RTCP CName.
|
||||||
int32_t SetCNAME(absl::string_view c_name) override;
|
int32_t SetCNAME(absl::string_view c_name) override;
|
||||||
|
|
||||||
// Get remote NTP.
|
|
||||||
int32_t RemoteNTP(uint32_t* received_ntp_secs,
|
|
||||||
uint32_t* received_ntp_frac,
|
|
||||||
uint32_t* rtcp_arrival_time_secs,
|
|
||||||
uint32_t* rtcp_arrival_time_frac,
|
|
||||||
uint32_t* rtcp_timestamp) const override;
|
|
||||||
|
|
||||||
// Get RoundTripTime.
|
// Get RoundTripTime.
|
||||||
int32_t RTT(uint32_t remote_ssrc,
|
int32_t RTT(uint32_t remote_ssrc,
|
||||||
int64_t* rtt,
|
int64_t* rtt,
|
||||||
|
|||||||
@ -158,6 +158,8 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
|
|||||||
NtpTime last_arrival_timestamp;
|
NtpTime last_arrival_timestamp;
|
||||||
// Received (a.k.a., remote) NTP timestamp for the last received RTCP SR.
|
// Received (a.k.a., remote) NTP timestamp for the last received RTCP SR.
|
||||||
NtpTime last_remote_timestamp;
|
NtpTime last_remote_timestamp;
|
||||||
|
// Received (a.k.a., remote) RTP timestamp from the last received RTCP SR.
|
||||||
|
uint32_t last_remote_rtp_timestamp;
|
||||||
// Total number of RTP data packets transmitted by the sender since starting
|
// Total number of RTP data packets transmitted by the sender since starting
|
||||||
// transmission up until the time this SR packet was generated. The count
|
// transmission up until the time this SR packet was generated. The count
|
||||||
// should be reset if the sender changes its SSRC identifier.
|
// should be reset if the sender changes its SSRC identifier.
|
||||||
@ -370,14 +372,6 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
|
|||||||
// Returns -1 on failure else 0.
|
// Returns -1 on failure else 0.
|
||||||
virtual int32_t SetCNAME(absl::string_view cname) = 0;
|
virtual int32_t SetCNAME(absl::string_view cname) = 0;
|
||||||
|
|
||||||
// Returns remote NTP.
|
|
||||||
// Returns -1 on failure else 0.
|
|
||||||
virtual int32_t RemoteNTP(uint32_t* received_ntp_secs,
|
|
||||||
uint32_t* received_ntp_frac,
|
|
||||||
uint32_t* rtcp_arrival_time_secs,
|
|
||||||
uint32_t* rtcp_arrival_time_frac,
|
|
||||||
uint32_t* rtcp_timestamp) const = 0;
|
|
||||||
|
|
||||||
// Returns current RTT (round-trip time) estimate.
|
// Returns current RTT (round-trip time) estimate.
|
||||||
// Returns -1 on failure else 0.
|
// Returns -1 on failure else 0.
|
||||||
virtual int32_t RTT(uint32_t remote_ssrc,
|
virtual int32_t RTT(uint32_t remote_ssrc,
|
||||||
|
|||||||
@ -404,13 +404,14 @@ void RtpVideoStreamReceiver2::RemoveReceiveCodecs() {
|
|||||||
absl::optional<Syncable::Info> RtpVideoStreamReceiver2::GetSyncInfo() const {
|
absl::optional<Syncable::Info> RtpVideoStreamReceiver2::GetSyncInfo() const {
|
||||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||||
Syncable::Info info;
|
Syncable::Info info;
|
||||||
if (rtp_rtcp_->RemoteNTP(&info.capture_time_ntp_secs,
|
absl::optional<RtpRtcpInterface::SenderReportStats> last_sr =
|
||||||
&info.capture_time_ntp_frac,
|
rtp_rtcp_->GetSenderReportStats();
|
||||||
/*rtcp_arrival_time_secs=*/nullptr,
|
if (!last_sr.has_value()) {
|
||||||
/*rtcp_arrival_time_frac=*/nullptr,
|
|
||||||
&info.capture_time_source_clock) != 0) {
|
|
||||||
return absl::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
|
info.capture_time_ntp_secs = last_sr->last_remote_timestamp.seconds();
|
||||||
|
info.capture_time_ntp_frac = last_sr->last_remote_timestamp.fractions();
|
||||||
|
info.capture_time_source_clock = last_sr->last_remote_rtp_timestamp;
|
||||||
|
|
||||||
if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_) {
|
if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_) {
|
||||||
return absl::nullopt;
|
return absl::nullopt;
|
||||||
@ -1140,23 +1141,20 @@ bool RtpVideoStreamReceiver2::DeliverRtcp(const uint8_t* rtcp_packet,
|
|||||||
// Waiting for valid rtt.
|
// Waiting for valid rtt.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
uint32_t ntp_secs = 0;
|
|
||||||
uint32_t ntp_frac = 0;
|
absl::optional<RtpRtcpInterface::SenderReportStats> last_sr =
|
||||||
uint32_t rtp_timestamp = 0;
|
rtp_rtcp_->GetSenderReportStats();
|
||||||
uint32_t received_ntp_secs = 0;
|
if (!last_sr.has_value()) {
|
||||||
uint32_t received_ntp_frac = 0;
|
|
||||||
if (rtp_rtcp_->RemoteNTP(&ntp_secs, &ntp_frac, &received_ntp_secs,
|
|
||||||
&received_ntp_frac, &rtp_timestamp) != 0) {
|
|
||||||
// Waiting for RTCP.
|
// Waiting for RTCP.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
NtpTime received_ntp(received_ntp_secs, received_ntp_frac);
|
int64_t time_since_received = clock_->CurrentNtpInMilliseconds() -
|
||||||
int64_t time_since_received =
|
last_sr->last_arrival_timestamp.ToMs();
|
||||||
clock_->CurrentNtpInMilliseconds() - received_ntp.ToMs();
|
|
||||||
// Don't use old SRs to estimate time.
|
// Don't use old SRs to estimate time.
|
||||||
if (time_since_received <= 1) {
|
if (time_since_received <= 1) {
|
||||||
ntp_estimator_.UpdateRtcpTimestamp(
|
ntp_estimator_.UpdateRtcpTimestamp(TimeDelta::Millis(rtt),
|
||||||
TimeDelta::Millis(rtt), NtpTime(ntp_secs, ntp_frac), rtp_timestamp);
|
last_sr->last_remote_timestamp,
|
||||||
|
last_sr->last_remote_rtp_timestamp);
|
||||||
absl::optional<int64_t> remote_to_local_clock_offset =
|
absl::optional<int64_t> remote_to_local_clock_offset =
|
||||||
ntp_estimator_.EstimateRemoteToLocalClockOffset();
|
ntp_estimator_.EstimateRemoteToLocalClockOffset();
|
||||||
if (remote_to_local_clock_offset.has_value()) {
|
if (remote_to_local_clock_offset.has_value()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user