Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: webrtc/common_types.h

Issue 1734933002: Move RTP stats histograms from VieChannel to SendStatisticsProxy. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Assert diff of RtpPacketCounter is valid Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_types.h
diff --git a/webrtc/common_types.h b/webrtc/common_types.h
index 2999bc95bc82a353fd820e87506059c29d552d8c..c59bc6240277ba5b1d773f0e4cdc295c7242c696 100644
--- a/webrtc/common_types.h
+++ b/webrtc/common_types.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_COMMON_TYPES_H_
#define WEBRTC_COMMON_TYPES_H_
+#include <assert.h>
#include <stddef.h>
#include <string.h>
@@ -791,6 +792,17 @@ struct RtpPacketCounter {
packets += other.packets;
}
+ void Subtract(const RtpPacketCounter& other) {
+ assert(header_bytes >= other.header_bytes);
+ header_bytes -= other.header_bytes;
+ assert(payload_bytes >= other.payload_bytes);
+ payload_bytes -= other.payload_bytes;
+ assert(padding_bytes >= other.padding_bytes);
+ padding_bytes -= other.padding_bytes;
+ assert(packets >= other.packets);
+ packets -= other.packets;
+ }
+
void AddPacket(size_t packet_length, const RTPHeader& header) {
++packets;
header_bytes += header.headerLength;
@@ -825,6 +837,18 @@ struct StreamDataCounters {
}
}
+ void Subtract(const StreamDataCounters& other) {
+ transmitted.Subtract(other.transmitted);
+ retransmitted.Subtract(other.retransmitted);
+ fec.Subtract(other.fec);
+ if (other.first_packet_time_ms != -1 &&
+ (other.first_packet_time_ms > first_packet_time_ms ||
+ first_packet_time_ms == -1)) {
+ // Use youngest time.
+ first_packet_time_ms = other.first_packet_time_ms;
+ }
+ }
+
int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const {
return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms);
}
« no previous file with comments | « no previous file | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698