Track padding and header size in log event.

Padding size and header size are not part of the header, but we still
want to log them. Add the values as separate fields to the log events.

Bug: webrtc:8111
Change-Id: I8dfa2ccafe679f96b8911b538a8512b0170bc642
Reviewed-on: https://webrtc-review.googlesource.com/c/106321
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25237}
This commit is contained in:
Bjorn Terelius
2018-10-17 14:30:19 +02:00
committed by Commit Bot
parent b9972fa37b
commit d932fba3bc
7 changed files with 56 additions and 38 deletions

View File

@ -17,13 +17,20 @@ namespace webrtc {
RtcEventRtpPacketIncoming::RtcEventRtpPacketIncoming(
const RtpPacketReceived& packet)
: packet_length_(packet.size()) {
: payload_length_(packet.payload_size()),
header_length_(packet.headers_size()),
padding_length_(packet.padding_size()) {
header_.CopyHeaderFrom(packet);
RTC_DCHECK_EQ(packet.size(),
payload_length_ + header_length_ + padding_length_);
}
RtcEventRtpPacketIncoming::RtcEventRtpPacketIncoming(
const RtcEventRtpPacketIncoming& other)
: RtcEvent(other.timestamp_us_), packet_length_(other.packet_length_) {
: RtcEvent(other.timestamp_us_),
payload_length_(other.payload_length_),
header_length_(other.header_length_),
padding_length_(other.padding_length_) {
header_.CopyHeaderFrom(other.header_);
}

View File

@ -31,8 +31,14 @@ class RtcEventRtpPacketIncoming final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
size_t packet_length() const {
return payload_length_ + header_length_ + padding_length_;
}
RtpPacket header_; // Only the packet's header will be stored here.
const size_t packet_length_; // Length before stripping away all but header.
const size_t payload_length_; // Media payload, excluding header and padding.
const size_t header_length_; // RTP header.
const size_t padding_length_; // RTP padding.
private:
RtcEventRtpPacketIncoming(const RtcEventRtpPacketIncoming& other);

View File

@ -18,14 +18,21 @@ namespace webrtc {
RtcEventRtpPacketOutgoing::RtcEventRtpPacketOutgoing(
const RtpPacketToSend& packet,
int probe_cluster_id)
: packet_length_(packet.size()), probe_cluster_id_(probe_cluster_id) {
: payload_length_(packet.payload_size()),
header_length_(packet.headers_size()),
padding_length_(packet.padding_size()),
probe_cluster_id_(probe_cluster_id) {
header_.CopyHeaderFrom(packet);
RTC_DCHECK_EQ(packet.size(),
payload_length_ + header_length_ + padding_length_);
}
RtcEventRtpPacketOutgoing::RtcEventRtpPacketOutgoing(
const RtcEventRtpPacketOutgoing& other)
: RtcEvent(other.timestamp_us_),
packet_length_(other.packet_length_),
payload_length_(other.payload_length_),
header_length_(other.header_length_),
padding_length_(other.padding_length_),
probe_cluster_id_(other.probe_cluster_id_) {
header_.CopyHeaderFrom(other.header_);
}

View File

@ -32,8 +32,14 @@ class RtcEventRtpPacketOutgoing final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
size_t packet_length() const {
return payload_length_ + header_length_ + padding_length_;
}
RtpPacket header_; // Only the packet's header will be stored here.
const size_t packet_length_; // Length before stripping away all but header.
const size_t payload_length_; // Media payload, excluding header and padding.
const size_t header_length_; // RTP header.
const size_t padding_length_; // RTP padding.
const int probe_cluster_id_;
private: