summaryrefslogtreecommitdiff
path: root/chromium/third_party/webrtc/modules/audio_coding/neteq/rtcp.h
blob: 5e066eb38f27675ec608730a3d7076a57ae74123 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

/*
 * RTCP statistics reporting.
 */

#ifndef RTCP_H
#define RTCP_H

#include "typedefs.h"

typedef struct
{
    uint16_t cycles; /* The number of wrap-arounds for the sequence number */
    uint16_t max_seq; /* The maximum sequence number received
     (starts from 0 again after wrap around) */
    uint16_t base_seq; /* The sequence number of the first packet that arrived */
    uint32_t received; /* The number of packets that has been received */
    uint32_t rec_prior; /* Number of packets received when last report was generated */
    uint32_t exp_prior; /* Number of packets that should have been received if no
     packets were lost. Stored value from last report. */
    uint32_t jitter; /* Jitter statistics at this instance (calculated according to RFC) */
    int32_t transit; /* Clock difference for previous packet (RTPtimestamp - LOCALtime_rec) */
} WebRtcNetEQ_RTCP_t;

/****************************************************************************
 * WebRtcNetEQ_RTCPInit(...)
 *
 * This function calculates the parameters that are needed for the RTCP 
 * report.
 *
 * Input:
 *		- RTCP_inst		: RTCP instance, that contains information about the 
 *						  packets that have been received etc.
 *		- seqNo			: Packet number of the first received frame.
 *
 * Return value			:  0 - Ok
 *						  -1 - Error
 */

int WebRtcNetEQ_RTCPInit(WebRtcNetEQ_RTCP_t *RTCP_inst, uint16_t uw16_seqNo);

/****************************************************************************
 * WebRtcNetEQ_RTCPUpdate(...)
 *
 * This function calculates the parameters that are needed for the RTCP 
 * report.
 *
 * Input:
 *		- RTCP_inst		: RTCP instance, that contains information about the 
 *						  packets that have been received etc.
 *		- seqNo			: Packet number of the first received frame.
 *		- timeStamp		: Time stamp from the RTP header.
 *		- recTime		: Time (in RTP timestamps) when this packet was received.
 *
 * Return value			:  0 - Ok
 *						  -1 - Error
 */

int WebRtcNetEQ_RTCPUpdate(WebRtcNetEQ_RTCP_t *RTCP_inst, uint16_t uw16_seqNo,
                           uint32_t uw32_timeStamp, uint32_t uw32_recTime);

/****************************************************************************
 * WebRtcNetEQ_RTCPGetStats(...)
 *
 * This function calculates the parameters that are needed for the RTCP 
 * report.
 *
 * Input:
 *		- RTCP_inst		: RTCP instance, that contains information about the 
 *						  packets that have been received etc.
 *      - doNotReset    : If non-zero, the fraction lost statistics will not
 *                        be reset.
 *
 * Output:
 *		- RTCP_inst		: Updated RTCP information (some statistics are 
 *						  reset when generating this report)
 *		- fraction_lost : Number of lost RTP packets divided by the number of
 *						  expected packets, since the last RTCP Report.
 *		- cum_lost		: Cumulative number of lost packets during this 
 *						  session.
 *		- ext_max		: Extended highest sequence number received.
 *		- jitter		: Inter-arrival jitter.
 *
 * Return value			:  0 - Ok
 *						  -1 - Error
 */

int WebRtcNetEQ_RTCPGetStats(WebRtcNetEQ_RTCP_t *RTCP_inst,
                             uint16_t *puw16_fraction_lost,
                             uint32_t *puw32_cum_lost, uint32_t *puw32_ext_max,
                             uint32_t *puw32_jitter, int16_t doNotReset);

#endif