blob: 45bb05846291f86038fc0387959bfe89a00916ad [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"
Mirko Bonadei71207422017-09-15 13:58:09 +020016#include "typedefs.h" // NOLINT(build/include)
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000017
18namespace webrtc {
19
20// Forward declaration.
21struct RTPHeader;
22
23class Rtcp {
24 public:
Yves Gerey665174f2018-06-19 15:03:05 +020025 Rtcp() { Init(0); }
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000026
27 ~Rtcp() {}
28
29 // Resets the RTCP statistics, and sets the first received sequence number.
30 void Init(uint16_t start_sequence_number);
31
32 // Updates the RTCP statistics with a new received packet.
33 void Update(const RTPHeader& rtp_header, uint32_t receive_timestamp);
34
35 // Returns the current RTCP statistics. If |no_reset| is true, the statistics
36 // are not reset, otherwise they are.
37 void GetStatistics(bool no_reset, RtcpStatistics* stats);
38
39 private:
Yves Gerey665174f2018-06-19 15:03:05 +020040 uint16_t cycles_; // The number of wrap-arounds for the sequence number.
41 uint16_t max_seq_no_; // The maximum sequence number received. Starts over
42 // from 0 after wrap-around.
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000043 uint16_t base_seq_no_; // The sequence number of the first received packet.
44 uint32_t received_packets_; // The number of packets that have been received.
45 uint32_t received_packets_prior_; // Number of packets received when last
46 // report was generated.
47 uint32_t expected_prior_; // Expected number of packets, at the time of the
48 // last report.
Yves Gerey665174f2018-06-19 15:03:05 +020049 int64_t jitter_; // Current jitter value in Q4.
50 int32_t transit_; // Clock difference for previous packet.
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000051
henrikg3c089d72015-09-16 05:37:44 -070052 RTC_DISALLOW_COPY_AND_ASSIGN(Rtcp);
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000053};
54
55} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020056#endif // MODULES_AUDIO_CODING_NETEQ_RTCP_H_