UniMRCP  1.3.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mpf_rtp_stat.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2014 Arsen Chaloyan
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Id: mpf_rtp_stat.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef MPF_RTP_STAT_H
20 #define MPF_RTP_STAT_H
21 
22 /**
23  * @file mpf_rtp_stat.h
24  * @brief RTP/RTCP Statistics
25  */
26 
27 #include "mpf.h"
28 
30 
31 /** RTP receiver statistics */
33 
34 /** RTCP statistics used in Sender Report (SR) */
36 /** RTCP statistics used in Receiver Report (RR) */
38 
39 
40 /** RTP receiver statistics */
41 struct rtp_rx_stat_t {
42  /** number of valid RTP packets received */
43  apr_uint32_t received_packets;
44  /** number of invalid RTP packets received */
45  apr_uint32_t invalid_packets;
46 
47  /** number of discarded in jitter buffer packets */
48  apr_uint32_t discarded_packets;
49  /** number of ignored packets */
50  apr_uint32_t ignored_packets;
51 
52  /** number of lost in network packets */
53  apr_uint32_t lost_packets;
54 
55  /** number of restarts */
56  apr_byte_t restarts;
57 };
58 
59 /** RTCP statistics used in Sender Report (SR) */
61  /** sender source identifier */
62  apr_uint32_t ssrc;
63  /** NTP timestamp (seconds) */
64  apr_uint32_t ntp_sec;
65  /** NTP timestamp (fractions) */
66  apr_uint32_t ntp_frac;
67  /** RTP timestamp */
68  apr_uint32_t rtp_ts;
69  /** packets sent */
70  apr_uint32_t sent_packets;
71  /** octets (bytes) sent */
72  apr_uint32_t sent_octets;
73 };
74 
75 /** RTCP statistics used in Receiver Report (RR) */
77  /** source identifier of RTP stream being received */
78  apr_uint32_t ssrc;
79  /** fraction lost since last SR/RR */
80  apr_uint32_t fraction:8;
81  /** cumulative number of packets lost (signed!) */
82  apr_int32_t lost:24;
83  /** extended last sequence number received */
84  apr_uint32_t last_seq;
85  /** interarrival jitter (RFC3550) */
86  apr_uint32_t jitter;
87  /** last SR packet from this source */
88  apr_uint32_t lsr;
89  /** delay since last SR packet */
90  apr_uint32_t dlsr;
91 };
92 
93 
94 
95 /** Reset RTCP SR statistics */
96 static APR_INLINE void mpf_rtcp_sr_stat_reset(rtcp_sr_stat_t *sr_stat)
97 {
98  memset(sr_stat,0,sizeof(rtcp_sr_stat_t));
99 }
100 
101 /** Reset RTCP RR statistics */
102 static APR_INLINE void mpf_rtcp_rr_stat_reset(rtcp_rr_stat_t *rr_stat)
103 {
104  memset(rr_stat,0,sizeof(rtcp_rr_stat_t));
105 }
106 
107 /** Reset RTP receiver statistics */
108 static APR_INLINE void mpf_rtp_rx_stat_reset(rtp_rx_stat_t *rx_stat)
109 {
110  memset(rx_stat,0,sizeof(rtp_rx_stat_t));
111 }
112 
114 
115 #endif /* MPF_RTP_STAT_H */