Skip to content

Commit

Permalink
Cleanup networkroute.h
Browse files Browse the repository at this point in the history
This change removes the constructors in favor of naming the fields
of the struct.

[email protected]

Bug: None
Change-Id: I23ae1165c20994d2efef10184570065957b279af
Reviewed-on: https://webrtc-review.googlesource.com/90081
Commit-Queue: Steve Anton <[email protected]>
Reviewed-by: Qingsi Wang <[email protected]>
Cr-Commit-Position: refs/heads/master@{#24071}
  • Loading branch information
steveanton committed Jul 23, 2018
1 parent 24db573 commit ea1bb35
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
7 changes: 5 additions & 2 deletions pc/channel_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
31 changes: 7 additions & 24 deletions rtc_base/networkroute.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion video/video_send_stream_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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]() {
Expand Down

0 comments on commit ea1bb35

Please sign in to comment.