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 { return last_received_block_; } | |
philipel
2016/02/29 13:21:48
Move to .cc file.
danilchap
2016/02/29 14:41:27
Done.
| |
44 bool HasRtt() const { return number_rtt_ > 0; } | |
philipel
2016/02/29 13:21:48
Move to .cc file.
danilchap
2016/02/29 14:41:27
Done.
| |
45 uint32_t LastRttMs() const; | |
philipel
2016/02/29 13:21:48
If you don't rely on uin32_t arithmetic then chang
danilchap
2016/02/29 14:41:27
What is motivation for using int?
uint32 shows the
philipel
2016/03/03 14:00:59
This should no longer be an int, it should now be
danilchap
2016/03/03 14:44:49
Not always, when time units are not ms, uint32_t i
| |
46 uint32_t MinRttMs() const; | |
47 uint32_t MaxRttMs() const; | |
48 uint32_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(uint32_t now); | |
54 // Number of blocks received where rtt could be calculated. | |
55 size_t number_rtt_; | |
philipel
2016/02/29 13:21:48
Change to int.
danilchap
2016/02/29 14:41:27
Isn't size_t default type for counting?
philipel
2016/03/03 14:00:59
The style guide is not clear, size_t is fine.
| |
56 // rtt is stored in 1/2^16 seconds (compact ntp representation). | |
57 uint32_t last_rtt_; | |
philipel
2016/02/29 13:21:48
int, for the following 3 as well.
danilchap
2016/02/29 14:41:27
Acknowledged.
philipel
2016/03/03 14:00:59
Should use int64_t instead of uint32_t.
danilchap
2016/03/03 14:44:48
This time is based on compact ntp time units, so p
| |
58 uint32_t min_rtt_; | |
59 uint32_t max_rtt_; | |
60 uint64_t sum_rtt_; | |
philipel
2016/02/29 13:21:48
int :)
danilchap
2016/02/29 14:41:27
Unsure if 32 bits would be enough, prefer to use 6
| |
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 |