OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_REPORT_BLOCK_INFORMATION_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_REPORT_BLOCK_INFORMATION_H_ |
| 13 |
| 14 #include "webrtc/base/basictypes.h" |
| 15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 16 #include "webrtc/system_wrappers/include/ntp_time.h" |
| 17 |
| 18 namespace webrtc { |
| 19 namespace RTCPUtility { |
| 20 struct RTCPPacketReportBlockItem; |
| 21 } // namespace RTCPUtility |
| 22 |
| 23 namespace rtcp { |
| 24 class ReportBlock; |
| 25 |
| 26 // Keeps last received report block and some additional statistic information. |
| 27 class ReportBlockInformation { |
| 28 public: |
| 29 ReportBlockInformation(); |
| 30 ReportBlockInformation(const ReportBlockInformation&) = default; |
| 31 ~ReportBlockInformation() {} |
| 32 |
| 33 ReportBlockInformation& operator=(const ReportBlockInformation&) = default; |
| 34 // TODO(danilchap): Remove this version of the |
| 35 // function when RTCP parsing would switch from RTCPUtility. |
| 36 void AddBlock(const RTCPUtility::RTCPPacketReportBlockItem& block, |
| 37 uint32_t remote_ssrc, |
| 38 NtpTime now); |
| 39 void AddBlock(const rtcp::ReportBlock& block, |
| 40 uint32_t remote_ssrc, |
| 41 NtpTime now); |
| 42 |
| 43 const RTCPReportBlock& LastBlock() const; |
| 44 bool HasRtt() const; |
| 45 int64_t LastRttMs() const; |
| 46 int64_t MinRttMs() const; |
| 47 int64_t MaxRttMs() const; |
| 48 int64_t AvgRttMs() const; |
| 49 |
| 50 private: |
| 51 // TODO(danilchap): Incorporate this function into AddBlock when only one |
| 52 // version would be left. |
| 53 void AddRtt(NtpTime now); |
| 54 // Number of blocks received where rtt could be calculated. |
| 55 size_t number_rtt_; |
| 56 // rtt is stored in 1/2^16 seconds (compact ntp representation). |
| 57 uint32_t last_rtt_; |
| 58 uint32_t min_rtt_; |
| 59 uint32_t max_rtt_; |
| 60 uint64_t sum_rtt_; |
| 61 RTCPReportBlock last_received_block_; |
| 62 }; |
| 63 } // namespace rtcp |
| 64 } // namespace webrtc |
| 65 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_REPORT_BLOCK_INFORMATION_H_ |
OLD | NEW |