in RtcpTransceiver delete legacy rtt_observer callback

Bug: webrtc:8239
Change-Id: Id4f56887879513b5ddb89818f221d8686c373ed7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235370
Reviewed-by: Emil Lundmark <lndmrk@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35257}
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_config.cc b/modules/rtp_rtcp/source/rtcp_transceiver_config.cc
index 214d8fd..02c0fef 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_config.cc
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_config.cc
@@ -67,7 +67,7 @@
     RTC_LOG(LS_ERROR) << debug_id << "unsupported rtcp mode";
     return false;
   }
-  if (non_sender_rtt_measurement && !rtt_observer)
+  if (non_sender_rtt_measurement && !network_link_observer)
     RTC_LOG(LS_WARNING) << debug_id
                         << "Enabled special feature to calculate rtt, but no "
                            "rtt observer is provided.";
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_config.h b/modules/rtp_rtcp/source/rtcp_transceiver_config.h
index f24a23d..73b933d 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_config.h
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_config.h
@@ -99,12 +99,6 @@
   // Rtcp report block generator for outgoing receiver reports.
   ReceiveStatisticsProvider* receive_statistics = nullptr;
 
-  // Callback to pass result of rtt calculation. Should outlive RtcpTransceiver.
-  // Callbacks will be invoked on the `task_queue`.
-  // Deprecated, rtt_observer will be deleted in favor of more generic
-  // `network_link_observer`
-  RtcpRttStats* rtt_observer = nullptr;
-
   // Should outlive RtcpTransceiver.
   // Callbacks will be invoked on the `task_queue`.
   NetworkLinkRtcpObserver* network_link_observer = nullptr;
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc b/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc
index c56515e..c7e1198 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc
@@ -345,7 +345,8 @@
 }
 
 void RtcpTransceiverImpl::HandleDlrr(const rtcp::Dlrr& dlrr, Timestamp now) {
-  if (!config_.non_sender_rtt_measurement) {
+  if (!config_.non_sender_rtt_measurement ||
+      config_.network_link_observer == nullptr) {
     return;
   }
 
@@ -358,13 +359,7 @@
       continue;
     uint32_t rtt_ntp = receive_time_ntp - rti.delay_since_last_rr - rti.last_rr;
     int64_t rtt_ms = CompactNtpRttToMs(rtt_ntp);
-    if (config_.rtt_observer != nullptr) {
-      config_.rtt_observer->OnRttUpdate(rtt_ms);
-    }
-    if (config_.network_link_observer != nullptr) {
-      config_.network_link_observer->OnRttUpdate(now,
-                                                 TimeDelta::Millis(rtt_ms));
-    }
+    config_.network_link_observer->OnRttUpdate(now, TimeDelta::Millis(rtt_ms));
   }
 }
 
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc b/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
index a76f36d..cad361c 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
@@ -1152,33 +1152,6 @@
   EXPECT_FALSE(rtcp_parser.xr()->rrtr());
 }
 
-TEST(RtcpTransceiverImplTest, CalculatesRoundTripTimeOnDlrr) {
-  const uint32_t kSenderSsrc = 4321;
-  SimulatedClock clock(0);
-  MockRtcpRttStats rtt_observer;
-  MockTransport null_transport;
-  RtcpTransceiverConfig config;
-  config.clock = &clock;
-  config.feedback_ssrc = kSenderSsrc;
-  config.schedule_periodic_compound_packets = false;
-  config.outgoing_transport = &null_transport;
-  config.non_sender_rtt_measurement = true;
-  config.rtt_observer = &rtt_observer;
-  RtcpTransceiverImpl rtcp_transceiver(config);
-
-  Timestamp time = Timestamp::Micros(12345678);
-  webrtc::rtcp::ReceiveTimeInfo rti;
-  rti.ssrc = kSenderSsrc;
-  rti.last_rr = CompactNtp(clock.ConvertTimestampToNtpTime(time));
-  rti.delay_since_last_rr = SaturatedUsToCompactNtp(10 * 1000);
-  webrtc::rtcp::ExtendedReports xr;
-  xr.AddDlrrItem(rti);
-  auto raw_packet = xr.Build();
-
-  EXPECT_CALL(rtt_observer, OnRttUpdate(100 /* rtt_ms */));
-  rtcp_transceiver.ReceivePacket(raw_packet, time + TimeDelta::Millis(110));
-}
-
 TEST(RtcpTransceiverImplTest, PassRttFromDlrrToLinkObserver) {
   const uint32_t kSenderSsrc = 4321;
   MockNetworkLinkRtcpObserver link_observer;
@@ -1230,7 +1203,7 @@
   const uint32_t kSenderSsrc = 4321;
   const uint32_t kUnknownSsrc = 4322;
   SimulatedClock clock(0);
-  MockRtcpRttStats rtt_observer;
+  MockNetworkLinkRtcpObserver link_observer;
   MockTransport null_transport;
   RtcpTransceiverConfig config;
   config.clock = &clock;
@@ -1238,7 +1211,7 @@
   config.schedule_periodic_compound_packets = false;
   config.outgoing_transport = &null_transport;
   config.non_sender_rtt_measurement = true;
-  config.rtt_observer = &rtt_observer;
+  config.network_link_observer = &link_observer;
   RtcpTransceiverImpl rtcp_transceiver(config);
 
   Timestamp time = Timestamp::Micros(12345678);
@@ -1249,7 +1222,7 @@
   xr.AddDlrrItem(rti);
   auto raw_packet = xr.Build();
 
-  EXPECT_CALL(rtt_observer, OnRttUpdate(_)).Times(0);
+  EXPECT_CALL(link_observer, OnRttUpdate).Times(0);
   rtcp_transceiver.ReceivePacket(raw_packet, time + TimeDelta::Millis(100));
 }