blob: 009e019eee3c8dded0bb1592873abbe438c152df [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +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
11/*
12 * RTCP statistics reporting.
13 */
14
15#ifndef RTCP_H
16#define RTCP_H
17
18#include "typedefs.h"
19
20typedef struct
21{
22 WebRtc_UWord16 cycles; /* The number of wrap-arounds for the sequence number */
23 WebRtc_UWord16 max_seq; /* The maximum sequence number received
24 (starts from 0 again after wrap around) */
25 WebRtc_UWord16 base_seq; /* The sequence number of the first packet that arrived */
26 WebRtc_UWord32 received; /* The number of packets that has been received */
27 WebRtc_UWord32 rec_prior; /* Number of packets received when last report was generated */
28 WebRtc_UWord32 exp_prior; /* Number of packets that should have been received if no
29 packets were lost. Stored value from last report. */
30 WebRtc_UWord32 jitter; /* Jitter statistics at this instance (calculated according to RFC) */
31 WebRtc_Word32 transit; /* Clock difference for previous packet (RTPtimestamp - LOCALtime_rec) */
32} WebRtcNetEQ_RTCP_t;
33
34/****************************************************************************
35 * WebRtcNetEQ_RTCPInit(...)
36 *
37 * This function calculates the parameters that are needed for the RTCP
38 * report.
39 *
40 * Input:
41 * - RTCP_inst : RTCP instance, that contains information about the
42 * packets that have been received etc.
43 * - seqNo : Packet number of the first received frame.
44 *
45 * Return value : 0 - Ok
46 * -1 - Error
47 */
48
49int WebRtcNetEQ_RTCPInit(WebRtcNetEQ_RTCP_t *RTCP_inst, WebRtc_UWord16 uw16_seqNo);
50
51/****************************************************************************
52 * WebRtcNetEQ_RTCPUpdate(...)
53 *
54 * This function calculates the parameters that are needed for the RTCP
55 * report.
56 *
57 * Input:
58 * - RTCP_inst : RTCP instance, that contains information about the
59 * packets that have been received etc.
60 * - seqNo : Packet number of the first received frame.
61 * - timeStamp : Time stamp from the RTP header.
62 * - recTime : Time (in RTP timestamps) when this packet was received.
63 *
64 * Return value : 0 - Ok
65 * -1 - Error
66 */
67
68int WebRtcNetEQ_RTCPUpdate(WebRtcNetEQ_RTCP_t *RTCP_inst, WebRtc_UWord16 uw16_seqNo,
69 WebRtc_UWord32 uw32_timeStamp, WebRtc_UWord32 uw32_recTime);
70
71/****************************************************************************
72 * WebRtcNetEQ_RTCPGetStats(...)
73 *
74 * This function calculates the parameters that are needed for the RTCP
75 * report.
76 *
77 * Input:
78 * - RTCP_inst : RTCP instance, that contains information about the
79 * packets that have been received etc.
80 * - doNotReset : If non-zero, the fraction lost statistics will not
81 * be reset.
82 *
83 * Output:
84 * - RTCP_inst : Updated RTCP information (some statistics are
85 * reset when generating this report)
86 * - fraction_lost : Number of lost RTP packets divided by the number of
87 * expected packets, since the last RTCP Report.
88 * - cum_lost : Cumulative number of lost packets during this
89 * session.
90 * - ext_max : Extended highest sequence number received.
91 * - jitter : Inter-arrival jitter.
92 *
93 * Return value : 0 - Ok
94 * -1 - Error
95 */
96
97int WebRtcNetEQ_RTCPGetStats(WebRtcNetEQ_RTCP_t *RTCP_inst,
98 WebRtc_UWord16 *puw16_fraction_lost,
99 WebRtc_UWord32 *puw32_cum_lost, WebRtc_UWord32 *puw32_ext_max,
100 WebRtc_UWord32 *puw32_jitter, WebRtc_Word16 doNotReset);
101
102#endif