Cleanup networkroute.h
This change removes the constructors in favor of naming the fields of the struct. TBR=kwiberg@webrtc.org Bug: None Change-Id: I23ae1165c20994d2efef10184570065957b279af Reviewed-on: https://webrtc-review.googlesource.com/90081 Commit-Queue: Steve Anton <steveanton@webrtc.org> Reviewed-by: Qingsi Wang <qingsi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24071}
This commit is contained in:
@ -884,8 +884,11 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
|
||||
});
|
||||
WaitForThreads();
|
||||
EXPECT_EQ(1, media_channel1->num_network_route_changes());
|
||||
rtc::NetworkRoute expected_network_route(true, kLocalNetId, kRemoteNetId,
|
||||
kLastPacketId);
|
||||
rtc::NetworkRoute expected_network_route;
|
||||
expected_network_route.connected = true;
|
||||
expected_network_route.local_network_id = kLocalNetId;
|
||||
expected_network_route.remote_network_id = kRemoteNetId;
|
||||
expected_network_route.last_sent_packet_id = kLastPacketId;
|
||||
EXPECT_EQ(expected_network_route, media_channel1->last_network_route());
|
||||
EXPECT_EQ(kLastPacketId,
|
||||
media_channel1->last_network_route().last_sent_packet_id);
|
||||
|
@ -20,30 +20,13 @@
|
||||
namespace rtc {
|
||||
|
||||
struct NetworkRoute {
|
||||
bool connected;
|
||||
uint16_t local_network_id;
|
||||
uint16_t remote_network_id;
|
||||
int last_sent_packet_id; // Last packet id sent on the PREVIOUS route.
|
||||
int packet_overhead; // The overhead in bytes from IP layer and above.
|
||||
|
||||
NetworkRoute()
|
||||
: connected(false),
|
||||
local_network_id(0),
|
||||
remote_network_id(0),
|
||||
last_sent_packet_id(-1),
|
||||
packet_overhead(0) {}
|
||||
|
||||
// The route is connected if the local and remote network ids are provided.
|
||||
// TODO(zhihuang): Remove this and let the caller set the fields explicitly.
|
||||
NetworkRoute(bool connected,
|
||||
uint16_t local_net_id,
|
||||
uint16_t remote_net_id,
|
||||
int last_packet_id)
|
||||
: connected(connected),
|
||||
local_network_id(local_net_id),
|
||||
remote_network_id(remote_net_id),
|
||||
last_sent_packet_id(last_packet_id),
|
||||
packet_overhead(0) {}
|
||||
bool connected = false;
|
||||
uint16_t local_network_id = 0;
|
||||
uint16_t remote_network_id = 0;
|
||||
// Last packet id sent on the PREVIOUS route.
|
||||
int last_sent_packet_id = -1;
|
||||
// The overhead in bytes from IP layer and above.
|
||||
int packet_overhead = 0;
|
||||
|
||||
// |last_sent_packet_id| and |packet_overhead| do not affect the NetworkRoute
|
||||
// comparison.
|
||||
|
@ -1632,7 +1632,10 @@ TEST_F(VideoSendStreamTest, ChangingNetworkRoute) {
|
||||
}
|
||||
|
||||
void PerformTest() override {
|
||||
rtc::NetworkRoute new_route(true, 10, 20, -1);
|
||||
rtc::NetworkRoute new_route;
|
||||
new_route.connected = true;
|
||||
new_route.local_network_id = 10;
|
||||
new_route.remote_network_id = 20;
|
||||
BitrateConstraints bitrate_config;
|
||||
|
||||
task_queue_->SendTask([this, &new_route, &bitrate_config]() {
|
||||
|
Reference in New Issue
Block a user