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}
diff --git a/rtc_base/asyncpacketsocket.cc b/rtc_base/asyncpacketsocket.cc
index e1b1eae..2360e82 100644
--- a/rtc_base/asyncpacketsocket.cc
+++ b/rtc_base/asyncpacketsocket.cc
@@ -9,6 +9,7 @@
*/
#include "rtc_base/asyncpacketsocket.h"
+#include "rtc_base/nethelper.h"
namespace rtc {
@@ -33,6 +34,12 @@
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();