19a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org/*
29a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
39a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org *
49a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org *  Use of this source code is governed by a BSD-style license
59a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org *  that can be found in the LICENSE file in the root of the source
69a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org *  tree. An additional intellectual property rights grant can be found
79a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org *  in the file PATENTS.  All contributing project authors may
89a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
99a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org */
109a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
11e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_RTCP_H_
12e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_RTCP_H_
139a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
14774b3d38a4a0f1a8ec08972a3c543cb5d607ce13henrike@webrtc.org#include "webrtc/base/constructormagic.h"
15e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org#include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
169a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include "webrtc/typedefs.h"
179a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
189a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgnamespace webrtc {
199a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
209a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// Forward declaration.
219a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgstruct RTPHeader;
229a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
239a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgclass Rtcp {
249a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org public:
259a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  Rtcp() {
269a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    Init(0);
279a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  }
289a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
299a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  ~Rtcp() {}
309a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
319a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  // Resets the RTCP statistics, and sets the first received sequence number.
329a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void Init(uint16_t start_sequence_number);
339a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
349a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  // Updates the RTCP statistics with a new received packet.
359a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void Update(const RTPHeader& rtp_header, uint32_t receive_timestamp);
369a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
379a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  // Returns the current RTCP statistics. If |no_reset| is true, the statistics
389a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  // are not reset, otherwise they are.
399a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GetStatistics(bool no_reset, RtcpStatistics* stats);
409a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
419a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org private:
429a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  uint16_t cycles_;  // The number of wrap-arounds for the sequence number.
439a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  uint16_t max_seq_no_;  // The maximum sequence number received. Starts over
449a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org                         // from 0 after wrap-around.
459a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  uint16_t base_seq_no_;  // The sequence number of the first received packet.
469a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  uint32_t received_packets_;  // The number of packets that have been received.
479a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  uint32_t received_packets_prior_;  // Number of packets received when last
489a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org                                     // report was generated.
499a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  uint32_t expected_prior_;  // Expected number of packets, at the time of the
509a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org                             // last report.
519a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  uint32_t jitter_;  // Current jitter value.
529a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  int32_t transit_;  // Clock difference for previous packet.
539a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
549a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  DISALLOW_COPY_AND_ASSIGN(Rtcp);
559a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org};
569a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
579a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org}  // namespace webrtc
58e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org#endif  // WEBRTC_MODULES_AUDIO_CODING_NETEQ_RTCP_H_
59