webrtc/rtc_base/network_route.cc
Jonas Oreland 5b6a4d8908 Only print route if it has changed
This is a follow up change to https://webrtc-review.googlesource.com/c/src/+/170628
and modifies code to only LOG if the route really has changed.

Existing code will LOG like this, which is slightly annoying. Notice that the same route change is LOG:ed twice.
03-23 13:28:49.281 17986 18850 I rtp_transport_controller_send.cc: [1183:590] [18850] (line 253): Network route changed on transport audio: new_route = [ connected: 1 local: [ 2/4 Wifi turn: 0 ] remote: [ 2/3 Wifi turn: 0 ] packet_overhead_bytes: 32 ]
03-23 13:28:49.281 17986 18850 I rtp_transport_controller_send.cc: [1183:590] [18850] (line 278): old_route = [ connected: 1 local: [ 2/4 Wifi turn: 1 ] remote: [ 2/3 Wifi turn: 0 ] packet_overhead_bytes: 28 ]
03-23 13:28:49.281 17986 18850 I rtp_transport_controller_send.cc: [1183:591] [18850] (line 253): Network route changed on transport audio: new_route = [ connected: 1 local: [ 2/4 Wifi turn: 0 ] remote: [ 2/3 Wifi turn: 0 ] packet_overhead_bytes: 32 ]
03-23 13:28:49.282 17986 18850 I rtp_transport_controller_send.cc: [1183:591] [18850] (line 278): old_route = [ connected: 1 local: [ 2/4 Wifi turn: 0 ] remote: [ 2/3 Wifi turn: 0 ] packet_overhead_bytes: 32 ]

The way this method is called twice with same argument is out of scope
for this change.

BUG: webrtc:11434
Change-Id: I052d089c59714513a09cbaed49f24c8f1300af58
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171460
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30865}
2020-03-24 11:48:42 +00:00

27 lines
990 B
C++

/*
* Copyright 2020 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/network_route.h"
namespace rtc {
bool RouteEndpoint::operator==(const RouteEndpoint& other) const {
return adapter_type_ == other.adapter_type_ &&
adapter_id_ == other.adapter_id_ && network_id_ == other.network_id_ &&
uses_turn_ == other.uses_turn_;
}
bool NetworkRoute::operator==(const NetworkRoute& other) const {
return connected == other.connected && local == other.local &&
remote == other.remote && packet_overhead == other.packet_overhead &&
last_sent_packet_id == other.last_sent_packet_id;
}
} // namespace rtc