blob: ce2035b219c3b7c24d89de0495469fb0ab3dd3ab [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:
25 Rtcp() {
26 Init(0);
27 }
28
29 ~Rtcp() {}
30
31 // Resets the RTCP statistics, and sets the first received sequence number.
32 void Init(uint16_t start_sequence_number);
33
34 // Updates the RTCP statistics with a new received packet.
35 void Update(const RTPHeader& rtp_header, uint32_t receive_timestamp);
36
37 // Returns the current RTCP statistics. If |no_reset| is true, the statistics
38 // are not reset, otherwise they are.
39 void GetStatistics(bool no_reset, RtcpStatistics* stats);
40
41 private:
42 uint16_t cycles_; // The number of wrap-arounds for the sequence number.
43 uint16_t max_seq_no_; // The maximum sequence number received. Starts over
44 // from 0 after wrap-around.
45 uint16_t base_seq_no_; // The sequence number of the first received packet.
46 uint32_t received_packets_; // The number of packets that have been received.
47 uint32_t received_packets_prior_; // Number of packets received when last
48 // report was generated.
49 uint32_t expected_prior_; // Expected number of packets, at the time of the
50 // last report.
ossu6b6c88f2016-10-31 08:59:26 -070051 int64_t jitter_; // Current jitter value in Q4.
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000052 int32_t transit_; // Clock difference for previous packet.
53
henrikg3c089d72015-09-16 05:37:44 -070054 RTC_DISALLOW_COPY_AND_ASSIGN(Rtcp);
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000055};
56
57} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020058#endif // MODULES_AUDIO_CODING_NETEQ_RTCP_H_