Adds IP overhead info to PacketInfo.

This prepares for an upcoming CL removing the SocketAdress members.

Bug: webrtc:9586
Change-Id: Iacb03a106f1b143bd2d401a621abb99847a634ed
Reviewed-on: https://webrtc-review.googlesource.com/c/105325
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25124}
This commit is contained in:
Sebastian Jansson
2018-10-11 16:43:58 +02:00
committed by Commit Bot
parent 74cd1ef9f5
commit e8038e9aab
2 changed files with 8 additions and 0 deletions

View File

@ -9,6 +9,7 @@
*/
#include "rtc_base/asyncpacketsocket.h"
#include "rtc_base/nethelper.h"
namespace rtc {
@ -33,6 +34,12 @@ 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->local_socket_address = socket_from.GetLocalAddress();
if (!is_connectionless) {
info->remote_socket_address = socket_from.GetRemoteAddress();

View File

@ -153,6 +153,7 @@ struct PacketInfo {
absl::optional<uint16_t> network_id;
size_t packet_size_bytes = 0;
size_t turn_overhead_bytes = 0;
size_t ip_overhead_bytes = 0;
SocketAddress local_socket_address;
SocketAddress remote_socket_address;
};