Cleanup: Use common IP overhead definitions in test and prod code

This avoid duplication. As part of this moving the overhead calculation
to the IP address class so it's easier to find and more natural to use.

Bug: webrtc:9883
Change-Id: If4d865f445bc1a302572896932966ce30294e339
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169445
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30657}
This commit is contained in:
Sebastian Jansson
2020-03-02 11:32:23 +01:00
committed by Commit Bot
parent 61f74d91f8
commit db5d7e470f
7 changed files with 28 additions and 40 deletions

View File

@ -10,8 +10,6 @@
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/net_helper.h"
namespace rtc {
PacketTimeUpdateParams::PacketTimeUpdateParams() = default;
@ -35,12 +33,7 @@ void CopySocketInformationToPacketInfo(size_t packet_size_bytes,
bool is_connectionless,
rtc::PacketInfo* info) {
info->packet_size_bytes = packet_size_bytes;
// TODO(srte): Make sure that the family of the local socket is always set
// in the VirtualSocket implementation and remove this check.
int family = socket_from.GetLocalAddress().family();
if (family != 0) {
info->ip_overhead_bytes = cricket::GetIpOverhead(family);
}
info->ip_overhead_bytes = socket_from.GetLocalAddress().ipaddr().overhead();
}
} // namespace rtc