Moved routes tracking to rtp transport controller.
This prepares for eliminating OnNetworkRouteChanged in the Call class.
Bug: webrtc:8415
Change-Id: I62dc7226804e65c90b2a0a771dd6861f6760c8dd
Reviewed-on: https://webrtc-review.googlesource.com/54363
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22130}
diff --git a/call/BUILD.gn b/call/BUILD.gn
index b943221..683f528 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -97,6 +97,7 @@
"..:webrtc_common",
"../modules/congestion_controller",
"../modules/pacing",
+ "../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved",
]
}
diff --git a/call/call.cc b/call/call.cc
index c21c240..9f526cc 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -356,8 +356,6 @@
RTC_GUARDED_BY(&bitrate_crit_);
AvgCounter pacer_bitrate_kbps_counter_ RTC_GUARDED_BY(&bitrate_crit_);
- std::map<std::string, rtc::NetworkRoute> network_routes_;
-
std::unique_ptr<RtpTransportControllerSendInterface> transport_send_;
ReceiveSideCongestionController receive_side_cc_;
const std::unique_ptr<SendDelayStats> video_send_delay_stats_;
@@ -1026,27 +1024,7 @@
void Call::OnNetworkRouteChanged(const std::string& transport_name,
const rtc::NetworkRoute& network_route) {
RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_);
- // Check if the network route is connected.
- if (!network_route.connected) {
- RTC_LOG(LS_INFO) << "Transport " << transport_name << " is disconnected";
- // TODO(honghaiz): Perhaps handle this in SignalChannelNetworkState and
- // consider merging these two methods.
- return;
- }
-
- // Check whether the network route has changed on each transport.
- auto result =
- network_routes_.insert(std::make_pair(transport_name, network_route));
- auto kv = result.first;
- bool inserted = result.second;
- if (inserted) {
- // No need to reset BWE if this is the first time the network connects.
- return;
- }
- if (kv->second != network_route) {
- kv->second = network_route;
- transport_send_->OnNetworkRouteChanged(transport_name, network_route);
- }
+ transport_send_->OnNetworkRouteChanged(transport_name, network_route);
}
void Call::UpdateAggregateNetworkState() {
diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc
index a48d843..71be5cb 100644
--- a/call/rtp_transport_controller_send.cc
+++ b/call/rtp_transport_controller_send.cc
@@ -7,6 +7,7 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <utility>
#include "call/rtp_transport_controller_send.h"
#include "rtc_base/logging.h"
@@ -88,21 +89,41 @@
void RtpTransportControllerSend::OnNetworkRouteChanged(
const std::string& transport_name,
const rtc::NetworkRoute& network_route) {
- BitrateConstraints bitrate_config = bitrate_configurator_.GetConfig();
- RTC_LOG(LS_INFO) << "Network route changed on transport " << transport_name
- << ": new local network id "
- << network_route.local_network_id
- << " new remote network id "
- << network_route.remote_network_id
- << " Reset bitrates to min: "
- << bitrate_config.min_bitrate_bps
- << " bps, start: " << bitrate_config.start_bitrate_bps
- << " bps, max: " << bitrate_config.max_bitrate_bps
- << " bps.";
- RTC_DCHECK_GT(bitrate_config.start_bitrate_bps, 0);
- send_side_cc_.OnNetworkRouteChanged(
- network_route, bitrate_config.start_bitrate_bps,
- bitrate_config.min_bitrate_bps, bitrate_config.max_bitrate_bps);
+ // Check if the network route is connected.
+ if (!network_route.connected) {
+ RTC_LOG(LS_INFO) << "Transport " << transport_name << " is disconnected";
+ // TODO(honghaiz): Perhaps handle this in SignalChannelNetworkState and
+ // consider merging these two methods.
+ return;
+ }
+
+ // Check whether the network route has changed on each transport.
+ auto result =
+ network_routes_.insert(std::make_pair(transport_name, network_route));
+ auto kv = result.first;
+ bool inserted = result.second;
+ if (inserted) {
+ // No need to reset BWE if this is the first time the network connects.
+ return;
+ }
+ if (kv->second != network_route) {
+ kv->second = network_route;
+ BitrateConstraints bitrate_config = bitrate_configurator_.GetConfig();
+ RTC_LOG(LS_INFO) << "Network route changed on transport " << transport_name
+ << ": new local network id "
+ << network_route.local_network_id
+ << " new remote network id "
+ << network_route.remote_network_id
+ << " Reset bitrates to min: "
+ << bitrate_config.min_bitrate_bps
+ << " bps, start: " << bitrate_config.start_bitrate_bps
+ << " bps, max: " << bitrate_config.max_bitrate_bps
+ << " bps.";
+ RTC_DCHECK_GT(bitrate_config.start_bitrate_bps, 0);
+ send_side_cc_.OnNetworkRouteChanged(
+ network_route, bitrate_config.start_bitrate_bps,
+ bitrate_config.min_bitrate_bps, bitrate_config.max_bitrate_bps);
+ }
}
void RtpTransportControllerSend::OnNetworkAvailability(bool network_available) {
send_side_cc_.SignalNetworkState(network_available ? kNetworkUp
diff --git a/call/rtp_transport_controller_send.h b/call/rtp_transport_controller_send.h
index 30f0596..ec71614 100644
--- a/call/rtp_transport_controller_send.h
+++ b/call/rtp_transport_controller_send.h
@@ -11,6 +11,7 @@
#ifndef CALL_RTP_TRANSPORT_CONTROLLER_SEND_H_
#define CALL_RTP_TRANSPORT_CONTROLLER_SEND_H_
+#include <map>
#include <string>
#include "call/rtp_bitrate_configurator.h"
@@ -19,6 +20,7 @@
#include "modules/congestion_controller/include/send_side_congestion_controller.h"
#include "modules/pacing/packet_router.h"
#include "rtc_base/constructormagic.h"
+#include "rtc_base/networkroute.h"
namespace webrtc {
class Clock;
@@ -78,6 +80,7 @@
SendSideCongestionController send_side_cc_;
RtpKeepAliveConfig keepalive_;
RtpBitrateConfigurator bitrate_configurator_;
+ std::map<std::string, rtc::NetworkRoute> network_routes_;
RTC_DISALLOW_COPY_AND_ASSIGN(RtpTransportControllerSend);
};