Chromium Code Reviews| Index: webrtc/modules/rtp_rtcp/source/report_block_information.h | 
| diff --git a/webrtc/modules/rtp_rtcp/source/report_block_information.h b/webrtc/modules/rtp_rtcp/source/report_block_information.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..8f6470f610a58cb959ad6adf35d8cbd7f524b1ee | 
| --- /dev/null | 
| +++ b/webrtc/modules/rtp_rtcp/source/report_block_information.h | 
| @@ -0,0 +1,65 @@ | 
| +/* | 
| + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 
| + * | 
| + * Use of this source code is governed by a BSD-style license | 
| + * that can be found in the LICENSE file in the root of the source | 
| + * tree. An additional intellectual property rights grant can be found | 
| + * in the file PATENTS. All contributing project authors may | 
| + * be found in the AUTHORS file in the root of the source tree. | 
| + */ | 
| + | 
| +#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_REPORT_BLOCK_INFORMATION_H_ | 
| +#define WEBRTC_MODULES_RTP_RTCP_SOURCE_REPORT_BLOCK_INFORMATION_H_ | 
| + | 
| +#include "webrtc/base/basictypes.h" | 
| +#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 
| +#include "webrtc/system_wrappers/include/ntp_time.h" | 
| + | 
| +namespace webrtc { | 
| +namespace RTCPUtility { | 
| +struct RTCPPacketReportBlockItem; | 
| +} // namespace RTCPUtility | 
| + | 
| +namespace rtcp { | 
| +class ReportBlock; | 
| + | 
| +// Keeps last received report block and some additional statistic information. | 
| +class ReportBlockInformation { | 
| + public: | 
| + ReportBlockInformation(); | 
| + ReportBlockInformation(const ReportBlockInformation&) = default; | 
| + ~ReportBlockInformation() {} | 
| + | 
| + ReportBlockInformation& operator=(const ReportBlockInformation&) = default; | 
| + // TODO(danilchap): Remove this version of the | 
| + // function when RTCP parsing would switch from RTCPUtility. | 
| + void AddBlock(const RTCPUtility::RTCPPacketReportBlockItem& block, | 
| + uint32_t remote_ssrc, | 
| + NtpTime now); | 
| + void AddBlock(const rtcp::ReportBlock& block, | 
| + uint32_t remote_ssrc, | 
| + NtpTime now); | 
| + | 
| + 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.
 
 | 
| + 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.
 
 | 
| + 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
 
 | 
| + uint32_t MinRttMs() const; | 
| + uint32_t MaxRttMs() const; | 
| + uint32_t AvgRttMs() const; | 
| + | 
| + private: | 
| + // TODO(danilchap): Incorporate this function into AddBlock when only one | 
| + // version would be left. | 
| + void AddRtt(uint32_t now); | 
| + // Number of blocks received where rtt could be calculated. | 
| + 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.
 
 | 
| + // rtt is stored in 1/2^16 seconds (compact ntp representation). | 
| + 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
 
 | 
| + uint32_t min_rtt_; | 
| + uint32_t max_rtt_; | 
| + 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
 
 | 
| + RTCPReportBlock last_received_block_; | 
| +}; | 
| +} // namespace rtcp | 
| +} // namespace webrtc | 
| +#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_REPORT_BLOCK_INFORMATION_H_ |