From be810cba199757e2911adede723e823d6f7856ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Wed, 2 Dec 2020 14:25:03 +0100 Subject: [PATCH] Delete SetRtcpXrRrtrStatus, make it a construction-time setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: None Change-Id: If2c42af6038c2ce1dc4289b949a0a3a279bae1b9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195337 Reviewed-by: Danil Chapovalov Reviewed-by: Åsa Persson Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#32754} --- modules/rtp_rtcp/mocks/mock_rtp_rtcp.h | 1 - modules/rtp_rtcp/source/rtcp_receiver.cc | 7 +-- modules/rtp_rtcp/source/rtcp_receiver.h | 3 +- .../rtp_rtcp/source/rtcp_receiver_unittest.cc | 46 ++++++++++--------- modules/rtp_rtcp/source/rtcp_sender.cc | 13 +----- modules/rtp_rtcp/source/rtcp_sender.h | 9 +--- .../rtp_rtcp/source/rtcp_sender_unittest.cc | 15 +++--- modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 9 ---- modules/rtp_rtcp/source/rtp_rtcp_impl.h | 3 -- modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 9 ---- modules/rtp_rtcp/source/rtp_rtcp_impl2.h | 6 --- .../source/rtp_rtcp_impl2_unittest.cc | 3 +- .../rtp_rtcp/source/rtp_rtcp_impl_unittest.cc | 3 +- modules/rtp_rtcp/source/rtp_rtcp_interface.h | 7 +-- video/rtp_video_stream_receiver.cc | 21 +++++---- video/rtp_video_stream_receiver2.cc | 20 ++++---- 16 files changed, 67 insertions(+), 108 deletions(-) diff --git a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h index b2a6cbf687..77289c993b 100644 --- a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h +++ b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h @@ -149,7 +149,6 @@ class MockRtpRtcpInterface : public RtpRtcpInterface { GetLatestReportBlockData, (), (const, override)); - MOCK_METHOD(void, SetRtcpXrRrtrStatus, (bool enable), (override)); MOCK_METHOD(void, SetRemb, (int64_t bitrate, std::vector ssrcs), diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc index 1db5eeb550..a9ec2a10a0 100644 --- a/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -174,7 +174,7 @@ RTCPReceiver::RTCPReceiver(const RtpRtcpInterface::Configuration& config, // TODO(bugs.webrtc.org/10774): Remove fallback. remote_ssrc_(0), remote_sender_rtp_time_(0), - xr_rrtr_status_(false), + xr_rrtr_status_(config.non_sender_rtt_measurement), xr_rr_rtt_ms_(0), oldest_tmmbr_info_ms_(0), stats_callback_(config.rtcp_statistics_callback), @@ -256,11 +256,6 @@ int32_t RTCPReceiver::RTT(uint32_t remote_ssrc, return 0; } -void RTCPReceiver::SetRtcpXrRrtrStatus(bool enable) { - MutexLock lock(&rtcp_receiver_lock_); - xr_rrtr_status_ = enable; -} - bool RTCPReceiver::GetAndResetXrRrRtt(int64_t* rtt_ms) { RTC_DCHECK(rtt_ms); MutexLock lock(&rtcp_receiver_lock_); diff --git a/modules/rtp_rtcp/source/rtcp_receiver.h b/modules/rtp_rtcp/source/rtcp_receiver.h index f97fe61291..d735653f41 100644 --- a/modules/rtp_rtcp/source/rtcp_receiver.h +++ b/modules/rtp_rtcp/source/rtcp_receiver.h @@ -86,7 +86,6 @@ class RTCPReceiver final { int64_t* min_rtt_ms, int64_t* max_rtt_ms) const; - void SetRtcpXrRrtrStatus(bool enable); bool GetAndResetXrRrRtt(int64_t* rtt_ms); // Called once per second on the worker thread to do rtt calculations. @@ -252,7 +251,7 @@ class RTCPReceiver final { received_rrtrs_ssrc_it_ RTC_GUARDED_BY(rtcp_receiver_lock_); // Estimated rtt, zero when there is no valid estimate. - bool xr_rrtr_status_ RTC_GUARDED_BY(rtcp_receiver_lock_); + const bool xr_rrtr_status_; int64_t xr_rr_rtt_ms_; int64_t oldest_tmmbr_info_ms_ RTC_GUARDED_BY(rtcp_receiver_lock_); diff --git a/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc index 0506aedadd..1a1d94a4f0 100644 --- a/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc +++ b/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc @@ -838,11 +838,11 @@ TEST(RtcpReceiverTest, InjectExtendedReportsReceiverReferenceTimePacket) { TEST(RtcpReceiverTest, ExtendedReportsDlrrPacketNotToUsIgnored) { ReceiverMocks mocks; - RTCPReceiver receiver(DefaultConfiguration(&mocks), &mocks.rtp_rtcp_impl); - receiver.SetRemoteSSRC(kSenderSsrc); - + auto config = DefaultConfiguration(&mocks); // Allow calculate rtt using dlrr/rrtr, simulating media receiver side. - receiver.SetRtcpXrRrtrStatus(true); + config.non_sender_rtt_measurement = true; + RTCPReceiver receiver(config, &mocks.rtp_rtcp_impl); + receiver.SetRemoteSSRC(kSenderSsrc); rtcp::ExtendedReports xr; xr.SetSenderSsrc(kSenderSsrc); @@ -856,12 +856,13 @@ TEST(RtcpReceiverTest, ExtendedReportsDlrrPacketNotToUsIgnored) { TEST(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithSubBlock) { ReceiverMocks mocks; - RTCPReceiver receiver(DefaultConfiguration(&mocks), &mocks.rtp_rtcp_impl); + auto config = DefaultConfiguration(&mocks); + config.non_sender_rtt_measurement = true; + RTCPReceiver receiver(config, &mocks.rtp_rtcp_impl); receiver.SetRemoteSSRC(kSenderSsrc); const uint32_t kLastRR = 0x12345; const uint32_t kDelay = 0x23456; - receiver.SetRtcpXrRrtrStatus(true); int64_t rtt_ms = 0; EXPECT_FALSE(receiver.GetAndResetXrRrRtt(&rtt_ms)); @@ -880,12 +881,13 @@ TEST(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithSubBlock) { TEST(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithMultipleSubBlocks) { ReceiverMocks mocks; - RTCPReceiver receiver(DefaultConfiguration(&mocks), &mocks.rtp_rtcp_impl); + auto config = DefaultConfiguration(&mocks); + config.non_sender_rtt_measurement = true; + RTCPReceiver receiver(config, &mocks.rtp_rtcp_impl); receiver.SetRemoteSSRC(kSenderSsrc); const uint32_t kLastRR = 0x12345; const uint32_t kDelay = 0x56789; - receiver.SetRtcpXrRrtrStatus(true); rtcp::ExtendedReports xr; xr.SetSenderSsrc(kSenderSsrc); @@ -905,11 +907,11 @@ TEST(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithMultipleSubBlocks) { TEST(RtcpReceiverTest, InjectExtendedReportsPacketWithMultipleReportBlocks) { ReceiverMocks mocks; - RTCPReceiver receiver(DefaultConfiguration(&mocks), &mocks.rtp_rtcp_impl); + auto config = DefaultConfiguration(&mocks); + config.non_sender_rtt_measurement = true; + RTCPReceiver receiver(config, &mocks.rtp_rtcp_impl); receiver.SetRemoteSSRC(kSenderSsrc); - receiver.SetRtcpXrRrtrStatus(true); - rtcp::Rrtr rrtr; rtcp::ExtendedReports xr; xr.SetSenderSsrc(kSenderSsrc); @@ -927,11 +929,11 @@ TEST(RtcpReceiverTest, InjectExtendedReportsPacketWithMultipleReportBlocks) { TEST(RtcpReceiverTest, InjectExtendedReportsPacketWithUnknownReportBlock) { ReceiverMocks mocks; - RTCPReceiver receiver(DefaultConfiguration(&mocks), &mocks.rtp_rtcp_impl); + auto config = DefaultConfiguration(&mocks); + config.non_sender_rtt_measurement = true; + RTCPReceiver receiver(config, &mocks.rtp_rtcp_impl); receiver.SetRemoteSSRC(kSenderSsrc); - receiver.SetRtcpXrRrtrStatus(true); - rtcp::Rrtr rrtr; rtcp::ExtendedReports xr; xr.SetSenderSsrc(kSenderSsrc); @@ -955,25 +957,26 @@ TEST(RtcpReceiverTest, InjectExtendedReportsPacketWithUnknownReportBlock) { TEST(RtcpReceiverTest, TestExtendedReportsRrRttInitiallyFalse) { ReceiverMocks mocks; - RTCPReceiver receiver(DefaultConfiguration(&mocks), &mocks.rtp_rtcp_impl); + auto config = DefaultConfiguration(&mocks); + config.non_sender_rtt_measurement = true; + RTCPReceiver receiver(config, &mocks.rtp_rtcp_impl); receiver.SetRemoteSSRC(kSenderSsrc); - receiver.SetRtcpXrRrtrStatus(true); - int64_t rtt_ms; EXPECT_FALSE(receiver.GetAndResetXrRrRtt(&rtt_ms)); } TEST(RtcpReceiverTest, RttCalculatedAfterExtendedReportsDlrr) { ReceiverMocks mocks; - RTCPReceiver receiver(DefaultConfiguration(&mocks), &mocks.rtp_rtcp_impl); + auto config = DefaultConfiguration(&mocks); + config.non_sender_rtt_measurement = true; + RTCPReceiver receiver(config, &mocks.rtp_rtcp_impl); receiver.SetRemoteSSRC(kSenderSsrc); Random rand(0x0123456789abcdef); const int64_t kRttMs = rand.Rand(1, 9 * 3600 * 1000); const uint32_t kDelayNtp = rand.Rand(0, 0x7fffffff); const int64_t kDelayMs = CompactNtpRttToMs(kDelayNtp); - receiver.SetRtcpXrRrtrStatus(true); NtpTime now = TimeMicrosToNtp(mocks.clock.TimeInMicroseconds()); uint32_t sent_ntp = CompactNtp(now); mocks.clock.AdvanceTimeMilliseconds(kRttMs + kDelayMs); @@ -991,7 +994,9 @@ TEST(RtcpReceiverTest, RttCalculatedAfterExtendedReportsDlrr) { TEST(RtcpReceiverTest, XrDlrrCalculatesNegativeRttAsOne) { ReceiverMocks mocks; - RTCPReceiver receiver(DefaultConfiguration(&mocks), &mocks.rtp_rtcp_impl); + auto config = DefaultConfiguration(&mocks); + config.non_sender_rtt_measurement = true; + RTCPReceiver receiver(config, &mocks.rtp_rtcp_impl); receiver.SetRemoteSSRC(kSenderSsrc); Random rand(0x0123456789abcdef); @@ -1001,7 +1006,6 @@ TEST(RtcpReceiverTest, XrDlrrCalculatesNegativeRttAsOne) { NtpTime now = TimeMicrosToNtp(mocks.clock.TimeInMicroseconds()); uint32_t sent_ntp = CompactNtp(now); mocks.clock.AdvanceTimeMilliseconds(kRttMs + kDelayMs); - receiver.SetRtcpXrRrtrStatus(true); rtcp::ExtendedReports xr; xr.SetSenderSsrc(kSenderSsrc); diff --git a/modules/rtp_rtcp/source/rtcp_sender.cc b/modules/rtp_rtcp/source/rtcp_sender.cc index 61e6085bb1..b29c1d03f3 100644 --- a/modules/rtp_rtcp/source/rtcp_sender.cc +++ b/modules/rtp_rtcp/source/rtcp_sender.cc @@ -173,7 +173,8 @@ RTCPSender::RTCPSender(const RtpRtcpInterface::Configuration& config) packet_oh_send_(0), max_packet_size_(IP_PACKET_SIZE - 28), // IPv4 + UDP by default. - xr_send_receiver_reference_time_enabled_(false), + xr_send_receiver_reference_time_enabled_( + config.non_sender_rtt_measurement), packet_type_counter_observer_(config.rtcp_packet_type_counter_observer), send_video_bitrate_allocation_(false), last_payload_type_(-1) { @@ -896,16 +897,6 @@ void RTCPSender::SetCsrcs(const std::vector& csrcs) { csrcs_ = csrcs; } -void RTCPSender::SendRtcpXrReceiverReferenceTime(bool enable) { - MutexLock lock(&mutex_rtcp_sender_); - xr_send_receiver_reference_time_enabled_ = enable; -} - -bool RTCPSender::RtcpXrReceiverReferenceTime() const { - MutexLock lock(&mutex_rtcp_sender_); - return xr_send_receiver_reference_time_enabled_; -} - void RTCPSender::SetTmmbn(std::vector bounding_set) { MutexLock lock(&mutex_rtcp_sender_); tmmbn_to_send_ = std::move(bounding_set); diff --git a/modules/rtp_rtcp/source/rtcp_sender.h b/modules/rtp_rtcp/source/rtcp_sender.h index b7238c3d03..cc9091dfc7 100644 --- a/modules/rtp_rtcp/source/rtcp_sender.h +++ b/modules/rtp_rtcp/source/rtcp_sender.h @@ -142,12 +142,6 @@ class RTCPSender final { void SetTmmbn(std::vector bounding_set) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_); - void SendRtcpXrReceiverReferenceTime(bool enable) - RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_); - - bool RtcpXrReceiverReferenceTime() const - RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_); - void SetCsrcs(const std::vector& csrcs) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_); @@ -267,8 +261,7 @@ class RTCPSender final { size_t max_packet_size_ RTC_GUARDED_BY(mutex_rtcp_sender_); // True if sending of XR Receiver reference time report is enabled. - bool xr_send_receiver_reference_time_enabled_ - RTC_GUARDED_BY(mutex_rtcp_sender_); + const bool xr_send_receiver_reference_time_enabled_; RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; RtcpPacketTypeCounter packet_type_counter_ RTC_GUARDED_BY(mutex_rtcp_sender_); diff --git a/modules/rtp_rtcp/source/rtcp_sender_unittest.cc b/modules/rtp_rtcp/source/rtcp_sender_unittest.cc index 08ef74a8f6..4c8038fd04 100644 --- a/modules/rtp_rtcp/source/rtcp_sender_unittest.cc +++ b/modules/rtp_rtcp/source/rtcp_sender_unittest.cc @@ -523,10 +523,11 @@ TEST_F(RtcpSenderTest, SendXrWithMultipleDlrrSubBlocks) { } TEST_F(RtcpSenderTest, SendXrWithRrtr) { - auto rtcp_sender = CreateRtcpSender(GetDefaultConfig()); + RtpRtcpInterface::Configuration config = GetDefaultConfig(); + config.non_sender_rtt_measurement = true; + auto rtcp_sender = CreateRtcpSender(config); rtcp_sender->SetRTCPStatus(RtcpMode::kCompound); EXPECT_EQ(0, rtcp_sender->SetSendingStatus(feedback_state(), false)); - rtcp_sender->SendRtcpXrReceiverReferenceTime(true); NtpTime ntp = TimeMicrosToNtp(clock_.TimeInMicroseconds()); EXPECT_EQ(0, rtcp_sender->SendRTCP(feedback_state(), kRtcpReport)); EXPECT_EQ(1, parser()->xr()->num_packets()); @@ -537,19 +538,21 @@ TEST_F(RtcpSenderTest, SendXrWithRrtr) { } TEST_F(RtcpSenderTest, TestNoXrRrtrSentIfSending) { - auto rtcp_sender = CreateRtcpSender(GetDefaultConfig()); + RtpRtcpInterface::Configuration config = GetDefaultConfig(); + config.non_sender_rtt_measurement = true; + auto rtcp_sender = CreateRtcpSender(config); rtcp_sender->SetRTCPStatus(RtcpMode::kCompound); EXPECT_EQ(0, rtcp_sender->SetSendingStatus(feedback_state(), true)); - rtcp_sender->SendRtcpXrReceiverReferenceTime(true); EXPECT_EQ(0, rtcp_sender->SendRTCP(feedback_state(), kRtcpReport)); EXPECT_EQ(0, parser()->xr()->num_packets()); } TEST_F(RtcpSenderTest, TestNoXrRrtrSentIfNotEnabled) { - auto rtcp_sender = CreateRtcpSender(GetDefaultConfig()); + RtpRtcpInterface::Configuration config = GetDefaultConfig(); + config.non_sender_rtt_measurement = false; + auto rtcp_sender = CreateRtcpSender(config); rtcp_sender->SetRTCPStatus(RtcpMode::kCompound); EXPECT_EQ(0, rtcp_sender->SetSendingStatus(feedback_state(), false)); - rtcp_sender->SendRtcpXrReceiverReferenceTime(false); EXPECT_EQ(0, rtcp_sender->SendRTCP(feedback_state(), kRtcpReport)); EXPECT_EQ(0, parser()->xr()->num_packets()); } diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index b2268c7d1c..ddac5c98d6 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -536,15 +536,6 @@ int32_t ModuleRtpRtcpImpl::SetRTCPApplicationSpecificData( return -1; } -void ModuleRtpRtcpImpl::SetRtcpXrRrtrStatus(bool enable) { - rtcp_receiver_.SetRtcpXrRrtrStatus(enable); - rtcp_sender_.SendRtcpXrReceiverReferenceTime(enable); -} - -bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const { - return rtcp_sender_.RtcpXrReceiverReferenceTime(); -} - // TODO(asapersson): Replace this method with the one below. int32_t ModuleRtpRtcpImpl::DataCountersRTP(size_t* bytes_sent, uint32_t* packets_sent) const { diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h index e04988e708..f0b08f0ad5 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -247,9 +247,6 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp { const uint8_t* data, uint16_t length) override; - // (XR) Receiver reference time report. - void SetRtcpXrRrtrStatus(bool enable) override; - // Video part. int32_t SendLossNotification(uint16_t last_decoded_seq_num, uint16_t last_received_seq_num, diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc index 88ede3d437..94dc2977e0 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc @@ -479,15 +479,6 @@ int32_t ModuleRtpRtcpImpl2::SendRTCP(RTCPPacketType packet_type) { return rtcp_sender_.SendRTCP(GetFeedbackState(), packet_type); } -void ModuleRtpRtcpImpl2::SetRtcpXrRrtrStatus(bool enable) { - rtcp_receiver_.SetRtcpXrRrtrStatus(enable); - rtcp_sender_.SendRtcpXrReceiverReferenceTime(enable); -} - -bool ModuleRtpRtcpImpl2::RtcpXrRrtrStatus() const { - return rtcp_sender_.RtcpXrReceiverReferenceTime(); -} - void ModuleRtpRtcpImpl2::GetSendStreamDataCounters( StreamDataCounters* rtp_counters, StreamDataCounters* rtx_counters) const { diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h index 1dde49d8b6..9431e75884 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h @@ -234,9 +234,6 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface, void SendCombinedRtcpPacket( std::vector> rtcp_packets) override; - // (XR) Receiver reference time report. - void SetRtcpXrRrtrStatus(bool enable) override; - // Video part. int32_t SendLossNotification(uint16_t last_decoded_seq_num, uint16_t last_received_seq_num, @@ -291,9 +288,6 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface, // Returns true if the module is configured to store packets. bool StorePackets() const; - // Returns current Receiver Reference Time Report (RTTR) status. - bool RtcpXrRrtrStatus() const; - TaskQueueBase* const worker_queue_; RTC_NO_UNIQUE_ADDRESS SequenceChecker process_thread_checker_; diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc index fefc853919..3b666422b8 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc @@ -160,6 +160,7 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver { config.rtcp_report_interval_ms = rtcp_report_interval_ms_; config.local_media_ssrc = is_sender_ ? kSenderSsrc : kReceiverSsrc; config.need_rtp_packet_infos = true; + config.non_sender_rtt_measurement = true; impl_.reset(new ModuleRtpRtcpImpl2(config)); impl_->SetRemoteSSRC(is_sender_ ? kReceiverSsrc : kSenderSsrc); @@ -321,8 +322,6 @@ TEST_F(RtpRtcpImpl2Test, Rtt) { } TEST_F(RtpRtcpImpl2Test, RttForReceiverOnly) { - receiver_.impl_->SetRtcpXrRrtrStatus(true); - // Receiver module should send a Receiver time reference report (RTRR). EXPECT_EQ(0, receiver_.impl_->SendRTCP(kRtcpReport)); diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index f89a097cc0..05c6ae1cbf 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -155,6 +155,7 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver { config.rtcp_report_interval_ms = rtcp_report_interval_ms_; config.local_media_ssrc = is_sender_ ? kSenderSsrc : kReceiverSsrc; config.need_rtp_packet_infos = true; + config.non_sender_rtt_measurement = true; impl_.reset(new ModuleRtpRtcpImpl(config)); impl_->SetRemoteSSRC(is_sender_ ? kReceiverSsrc : kSenderSsrc); @@ -309,8 +310,6 @@ TEST_F(RtpRtcpImplTest, Rtt) { } TEST_F(RtpRtcpImplTest, RttForReceiverOnly) { - receiver_.impl_->SetRtcpXrRrtrStatus(true); - // Receiver module should send a Receiver time reference report (RTRR). EXPECT_EQ(0, receiver_.impl_->SendRTCP(kRtcpReport)); diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h index accf50c896..5bb3eb55e2 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h +++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h @@ -144,6 +144,10 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface { // overhead. bool enable_rtx_padding_prioritization = true; + // Estimate RTT as non-sender as described in + // https://tools.ietf.org/html/rfc3611#section-4.4 and #section-4.5 + bool non_sender_rtt_measurement = false; + private: RTC_DISALLOW_COPY_AND_ASSIGN(Configuration); }; @@ -369,9 +373,6 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface { // that pair. virtual std::vector GetLatestReportBlockData() const = 0; - // (XR) Sets Receiver Reference Time Report (RTTR) status. - virtual void SetRtcpXrRrtrStatus(bool enable) = 0; - // (REMB) Receiver Estimated Max Bitrate. // Schedules sending REMB on next and following sender/receiver reports. void SetRemb(int64_t bitrate_bps, std::vector ssrcs) override = 0; diff --git a/video/rtp_video_stream_receiver.cc b/video/rtp_video_stream_receiver.cc index 1b8828be2c..ab60070d82 100644 --- a/video/rtp_video_stream_receiver.cc +++ b/video/rtp_video_stream_receiver.cc @@ -84,6 +84,7 @@ std::unique_ptr CreateRtpRtcpModule( RtcpRttStats* rtt_stats, RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer, RtcpCnameCallback* rtcp_cname_callback, + bool non_sender_rtt_measurement, uint32_t local_ssrc) { RtpRtcpInterface::Configuration configuration; configuration.clock = clock; @@ -96,6 +97,7 @@ std::unique_ptr CreateRtpRtcpModule( rtcp_packet_type_counter_observer; configuration.rtcp_cname_callback = rtcp_cname_callback; configuration.local_media_ssrc = local_ssrc; + configuration.non_sender_rtt_measurement = non_sender_rtt_measurement; std::unique_ptr rtp_rtcp = RtpRtcp::DEPRECATED_Create(configuration); rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound); @@ -255,13 +257,15 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver( config->rtp.extensions)), receiving_(false), last_packet_log_ms_(-1), - rtp_rtcp_(CreateRtpRtcpModule(clock, - rtp_receive_statistics_, - transport, - rtt_stats, - rtcp_packet_type_counter_observer, - rtcp_cname_callback, - config_.rtp.local_ssrc)), + rtp_rtcp_(CreateRtpRtcpModule( + clock, + rtp_receive_statistics_, + transport, + rtt_stats, + rtcp_packet_type_counter_observer, + rtcp_cname_callback, + config_.rtp.rtcp_xr.receiver_reference_time_report, + config_.rtp.local_ssrc)), complete_frame_callback_(complete_frame_callback), keyframe_request_sender_(keyframe_request_sender), // TODO(bugs.webrtc.org/10336): Let |rtcp_feedback_buffer_| communicate @@ -299,9 +303,6 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver( rtp_receive_statistics_->SetMaxReorderingThreshold( config_.rtp.rtx_ssrc, max_reordering_threshold); } - if (config_.rtp.rtcp_xr.receiver_reference_time_report) - rtp_rtcp_->SetRtcpXrRrtrStatus(true); - ParseFieldTrial( {&forced_playout_delay_max_ms_, &forced_playout_delay_min_ms_}, field_trial::FindFullName("WebRTC-ForcePlayoutDelay")); diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc index f3345597ea..63d8c3835d 100644 --- a/video/rtp_video_stream_receiver2.cc +++ b/video/rtp_video_stream_receiver2.cc @@ -83,6 +83,7 @@ std::unique_ptr CreateRtpRtcpModule( RtcpRttStats* rtt_stats, RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer, RtcpCnameCallback* rtcp_cname_callback, + bool non_sender_rtt_measurement, uint32_t local_ssrc) { RtpRtcpInterface::Configuration configuration; configuration.clock = clock; @@ -95,6 +96,7 @@ std::unique_ptr CreateRtpRtcpModule( rtcp_packet_type_counter_observer; configuration.rtcp_cname_callback = rtcp_cname_callback; configuration.local_media_ssrc = local_ssrc; + configuration.non_sender_rtt_measurement = non_sender_rtt_measurement; std::unique_ptr rtp_rtcp = ModuleRtpRtcpImpl2::Create(configuration); @@ -228,13 +230,15 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2( config->rtp.extensions)), receiving_(false), last_packet_log_ms_(-1), - rtp_rtcp_(CreateRtpRtcpModule(clock, - rtp_receive_statistics_, - transport, - rtt_stats, - rtcp_packet_type_counter_observer, - rtcp_cname_callback, - config_.rtp.local_ssrc)), + rtp_rtcp_(CreateRtpRtcpModule( + clock, + rtp_receive_statistics_, + transport, + rtt_stats, + rtcp_packet_type_counter_observer, + rtcp_cname_callback, + config_.rtp.rtcp_xr.receiver_reference_time_report, + config_.rtp.local_ssrc)), complete_frame_callback_(complete_frame_callback), keyframe_request_sender_(keyframe_request_sender), // TODO(bugs.webrtc.org/10336): Let |rtcp_feedback_buffer_| communicate @@ -277,8 +281,6 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2( rtp_receive_statistics_->SetMaxReorderingThreshold( config_.rtp.rtx_ssrc, max_reordering_threshold); } - if (config_.rtp.rtcp_xr.receiver_reference_time_report) - rtp_rtcp_->SetRtcpXrRrtrStatus(true); ParseFieldTrial( {&forced_playout_delay_max_ms_, &forced_playout_delay_min_ms_},