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

Side by Side 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: Fixed nit, rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 padding_bytes(0), 784 padding_bytes(0),
785 packets(0) {} 785 packets(0) {}
786 786
787 void Add(const RtpPacketCounter& other) { 787 void Add(const RtpPacketCounter& other) {
788 header_bytes += other.header_bytes; 788 header_bytes += other.header_bytes;
789 payload_bytes += other.payload_bytes; 789 payload_bytes += other.payload_bytes;
790 padding_bytes += other.padding_bytes; 790 padding_bytes += other.padding_bytes;
791 packets += other.packets; 791 packets += other.packets;
792 } 792 }
793 793
794 void Subtract(const RtpPacketCounter& other) {
795 header_bytes -= other.header_bytes;
mflodman 2016/02/29 09:41:17 There's no >= 0 check, do we count on the user to
sprang_webrtc 2016/02/29 13:00:33 Yes. But I'll add a DCHECK to be sure.
796 payload_bytes -= other.payload_bytes;
797 padding_bytes -= other.padding_bytes;
798 packets -= other.packets;
799 }
800
794 void AddPacket(size_t packet_length, const RTPHeader& header) { 801 void AddPacket(size_t packet_length, const RTPHeader& header) {
795 ++packets; 802 ++packets;
796 header_bytes += header.headerLength; 803 header_bytes += header.headerLength;
797 padding_bytes += header.paddingLength; 804 padding_bytes += header.paddingLength;
798 payload_bytes += 805 payload_bytes +=
799 packet_length - (header.headerLength + header.paddingLength); 806 packet_length - (header.headerLength + header.paddingLength);
800 } 807 }
801 808
802 size_t TotalBytes() const { 809 size_t TotalBytes() const {
803 return header_bytes + payload_bytes + padding_bytes; 810 return header_bytes + payload_bytes + padding_bytes;
(...skipping 14 matching lines...) Expand all
818 retransmitted.Add(other.retransmitted); 825 retransmitted.Add(other.retransmitted);
819 fec.Add(other.fec); 826 fec.Add(other.fec);
820 if (other.first_packet_time_ms != -1 && 827 if (other.first_packet_time_ms != -1 &&
821 (other.first_packet_time_ms < first_packet_time_ms || 828 (other.first_packet_time_ms < first_packet_time_ms ||
822 first_packet_time_ms == -1)) { 829 first_packet_time_ms == -1)) {
823 // Use oldest time. 830 // Use oldest time.
824 first_packet_time_ms = other.first_packet_time_ms; 831 first_packet_time_ms = other.first_packet_time_ms;
825 } 832 }
826 } 833 }
827 834
835 void Subtract(const StreamDataCounters& other) {
836 transmitted.Subtract(other.transmitted);
837 retransmitted.Subtract(other.retransmitted);
838 fec.Subtract(other.fec);
839 if (other.first_packet_time_ms != -1 &&
840 (other.first_packet_time_ms > first_packet_time_ms ||
841 first_packet_time_ms == -1)) {
842 // Use youngest time.
843 first_packet_time_ms = other.first_packet_time_ms;
844 }
845 }
846
828 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { 847 int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const {
829 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); 848 return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms);
830 } 849 }
831 850
832 // Returns the number of bytes corresponding to the actual media payload (i.e. 851 // Returns the number of bytes corresponding to the actual media payload (i.e.
833 // RTP headers, padding, retransmissions and fec packets are excluded). 852 // RTP headers, padding, retransmissions and fec packets are excluded).
834 // Note this function does not have meaning for an RTX stream. 853 // Note this function does not have meaning for an RTX stream.
835 size_t MediaPayloadBytes() const { 854 size_t MediaPayloadBytes() const {
836 return transmitted.payload_bytes - retransmitted.payload_bytes - 855 return transmitted.payload_bytes - retransmitted.payload_bytes -
837 fec.payload_bytes; 856 fec.payload_bytes;
(...skipping 14 matching lines...) Expand all
852 uint32_t ssrc) = 0; 871 uint32_t ssrc) = 0;
853 }; 872 };
854 873
855 // RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size 874 // RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size
856 // RTCP mode is described by RFC 5506. 875 // RTCP mode is described by RFC 5506.
857 enum class RtcpMode { kOff, kCompound, kReducedSize }; 876 enum class RtcpMode { kOff, kCompound, kReducedSize };
858 877
859 } // namespace webrtc 878 } // namespace webrtc
860 879
861 #endif // WEBRTC_COMMON_TYPES_H_ 880 #endif // WEBRTC_COMMON_TYPES_H_
OLDNEW
« 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