Signal detailed packet info for each packet sent.

Per-packet info is now signaled in SentPacket to provide useful stats
for bandwidth consumption and overhead analysis in the network stack.

Bug: webrtc:9103
Change-Id: I2b8f6491567d0fa54cc559fc5a96d7aac7d9565e
Reviewed-on: https://webrtc-review.googlesource.com/66281
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Bjorn Mellem <mellem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22834}
diff --git a/rtc_base/asyncpacketsocket.h b/rtc_base/asyncpacketsocket.h
index 16f4de0..6ae0525 100644
--- a/rtc_base/asyncpacketsocket.h
+++ b/rtc_base/asyncpacketsocket.h
@@ -24,23 +24,28 @@
 // after changing the value.
 struct PacketTimeUpdateParams {
   PacketTimeUpdateParams();
+  PacketTimeUpdateParams(const PacketTimeUpdateParams& other);
   ~PacketTimeUpdateParams();
 
-  int rtp_sendtime_extension_id;    // extension header id present in packet.
+  int rtp_sendtime_extension_id = -1;  // extension header id present in packet.
   std::vector<char> srtp_auth_key;  // Authentication key.
-  int srtp_auth_tag_len;            // Authentication tag length.
-  int64_t srtp_packet_index;        // Required for Rtp Packet authentication.
+  int srtp_auth_tag_len = -1;       // Authentication tag length.
+  int64_t srtp_packet_index = -1;   // Required for Rtp Packet authentication.
 };
 
 // This structure holds meta information for the packet which is about to send
 // over network.
 struct PacketOptions {
-  PacketOptions() : dscp(DSCP_NO_CHANGE), packet_id(-1) {}
-  explicit PacketOptions(DiffServCodePoint dscp) : dscp(dscp), packet_id(-1) {}
+  PacketOptions();
+  explicit PacketOptions(DiffServCodePoint dscp);
+  PacketOptions(const PacketOptions& other);
+  ~PacketOptions();
 
-  DiffServCodePoint dscp;
-  int packet_id;  // 16 bits, -1 represents "not set".
+  DiffServCodePoint dscp = DSCP_NO_CHANGE;
+  int packet_id = -1;  // 16 bits, -1 represents "not set".
   PacketTimeUpdateParams packet_time_params;
+  // PacketInfo is passed to SentPacket when signaling this packet is sent.
+  PacketInfo info_signaled_after_sent;
 };
 
 // This structure will have the information about when packet is actually
@@ -138,6 +143,10 @@
   RTC_DISALLOW_COPY_AND_ASSIGN(AsyncPacketSocket);
 };
 
+void CopySocketInformationToPacketInfo(size_t packet_size_bytes,
+                                       const AsyncPacketSocket& socket_from,
+                                       rtc::PacketInfo* info);
+
 }  // namespace rtc
 
 #endif  // RTC_BASE_ASYNCPACKETSOCKET_H_