blob: b1de7eb7f487f27eb8bc696ce810698398498f09 [file] [log] [blame]
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +00001/*
2 * Copyright (c) 2011 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_AUDIO_CODING_NETEQ_RTCP_H_
12#define MODULES_AUDIO_CODING_NETEQ_RTCP_H_
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000013
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "modules/audio_coding/neteq/include/neteq.h"
15#include "rtc_base/constructormagic.h"
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000016
17namespace webrtc {
18
19// Forward declaration.
20struct RTPHeader;
21
22class Rtcp {
23 public:
Yves Gerey665174f2018-06-19 15:03:05 +020024 Rtcp() { Init(0); }
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000025
26 ~Rtcp() {}
27
28 // Resets the RTCP statistics, and sets the first received sequence number.
29 void Init(uint16_t start_sequence_number);
30
31 // Updates the RTCP statistics with a new received packet.
32 void Update(const RTPHeader& rtp_header, uint32_t receive_timestamp);
33
34 // Returns the current RTCP statistics. If |no_reset| is true, the statistics
35 // are not reset, otherwise they are.
36 void GetStatistics(bool no_reset, RtcpStatistics* stats);
37
38 private:
Yves Gerey665174f2018-06-19 15:03:05 +020039 uint16_t cycles_; // The number of wrap-arounds for the sequence number.
40 uint16_t max_seq_no_; // The maximum sequence number received. Starts over
41 // from 0 after wrap-around.
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000042 uint16_t base_seq_no_; // The sequence number of the first received packet.
43 uint32_t received_packets_; // The number of packets that have been received.
44 uint32_t received_packets_prior_; // Number of packets received when last
45 // report was generated.
46 uint32_t expected_prior_; // Expected number of packets, at the time of the
47 // last report.
Yves Gerey665174f2018-06-19 15:03:05 +020048 int64_t jitter_; // Current jitter value in Q4.
49 int32_t transit_; // Clock difference for previous packet.
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000050
henrikg3c089d72015-09-16 05:37:44 -070051 RTC_DISALLOW_COPY_AND_ASSIGN(Rtcp);
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000052};
53
54} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020055#endif // MODULES_AUDIO_CODING_NETEQ_RTCP_H_