1 /* 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 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_RTCP_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_RTCP_H_ 13 14 #include "webrtc/base/constructormagic.h" 15 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" 16 #include "webrtc/typedefs.h" 17 18 namespace webrtc { 19 20 // Forward declaration. 21 struct RTPHeader; 22 23 class Rtcp { 24 public: Rtcp()25 Rtcp() { 26 Init(0); 27 } 28 ~Rtcp()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. 51 uint32_t jitter_; // Current jitter value. 52 int32_t transit_; // Clock difference for previous packet. 53 54 RTC_DISALLOW_COPY_AND_ASSIGN(Rtcp); 55 }; 56 57 } // namespace webrtc 58 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_RTCP_H_ 59