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}
This commit is contained in:
Qingsi Wang
2018-04-11 20:14:17 -07:00
committed by Commit Bot
parent bc49b10a69
commit 6e641e64b2
17 changed files with 188 additions and 34 deletions

View File

@ -25,6 +25,7 @@
#include "rtc_base/win32.h"
#endif
#include "api/optional.h"
#include "rtc_base/basictypes.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/socketaddress.h"
@ -123,13 +124,46 @@ inline bool IsBlockingError(int e) {
return (e == EWOULDBLOCK) || (e == EAGAIN) || (e == EINPROGRESS);
}
struct SentPacket {
SentPacket() : packet_id(-1), send_time_ms(-1) {}
SentPacket(int packet_id, int64_t send_time_ms)
: packet_id(packet_id), send_time_ms(send_time_ms) {}
enum class PacketType {
kUnknown,
kData,
kIceConnectivityCheck,
kIceConnectivityCheckResponse,
kStunMessage,
kTurnMessage,
};
int packet_id;
int64_t send_time_ms;
enum class PacketInfoProtocolType {
kUnknown,
kUdp,
kTcp,
kSsltcp,
kTls,
};
struct PacketInfo {
PacketInfo();
PacketInfo(const PacketInfo& info);
~PacketInfo();
PacketType packet_type = PacketType::kUnknown;
PacketInfoProtocolType protocol = PacketInfoProtocolType::kUnknown;
// A unique id assigned by the network manager, and rtc::nullopt if not set.
rtc::Optional<uint16_t> network_id;
size_t packet_size_bytes = 0;
size_t turn_overhead_bytes = 0;
SocketAddress local_socket_address;
SocketAddress remote_socket_address;
};
struct SentPacket {
SentPacket();
SentPacket(int packet_id, int64_t send_time_ms);
SentPacket(int packet_id, int64_t send_time_ms, const rtc::PacketInfo& info);
int packet_id = -1;
int64_t send_time_ms = -1;
rtc::PacketInfo info;
};
// General interface for the socket implementations of various networks. The