UniMRCP  1.7.0
mpf_rtp_stat.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 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 
17 #ifndef MPF_RTP_STAT_H
18 #define MPF_RTP_STAT_H
19 
20 /**
21  * @file mpf_rtp_stat.h
22  * @brief RTP/RTCP Statistics
23  */
24 
25 #include "mpf.h"
26 
28 
29 /** RTP receiver statistics */
31 
32 /** RTCP statistics used in Sender Report (SR) */
34 /** RTCP statistics used in Receiver Report (RR) */
36 
37 
38 /** RTP receiver statistics */
39 struct rtp_rx_stat_t {
40  /** number of valid RTP packets received */
41  apr_uint32_t received_packets;
42  /** number of invalid RTP packets received */
43  apr_uint32_t invalid_packets;
44 
45  /** number of discarded in jitter buffer packets */
46  apr_uint32_t discarded_packets;
47  /** number of ignored packets */
48  apr_uint32_t ignored_packets;
49 
50  /** number of lost in network packets */
51  apr_uint32_t lost_packets;
52 
53  /** number of restarts */
54  apr_byte_t restarts;
55 };
56 
57 /** RTCP statistics used in Sender Report (SR) */
59  /** sender source identifier */
60  apr_uint32_t ssrc;
61  /** NTP timestamp (seconds) */
62  apr_uint32_t ntp_sec;
63  /** NTP timestamp (fractions) */
64  apr_uint32_t ntp_frac;
65  /** RTP timestamp */
66  apr_uint32_t rtp_ts;
67  /** packets sent */
68  apr_uint32_t sent_packets;
69  /** octets (bytes) sent */
70  apr_uint32_t sent_octets;
71 };
72 
73 /** RTCP statistics used in Receiver Report (RR) */
75  /** source identifier of RTP stream being received */
76  apr_uint32_t ssrc;
77  /** fraction lost since last SR/RR */
78  apr_uint32_t fraction:8;
79  /** cumulative number of packets lost (signed!) */
80  apr_int32_t lost:24;
81  /** extended last sequence number received */
82  apr_uint32_t last_seq;
83  /** interarrival jitter (RFC3550) */
84  apr_uint32_t jitter;
85  /** last SR packet from this source */
86  apr_uint32_t lsr;
87  /** delay since last SR packet */
88  apr_uint32_t dlsr;
89 };
90 
91 
92 
93 /** Reset RTCP SR statistics */
94 static APR_INLINE void mpf_rtcp_sr_stat_reset(rtcp_sr_stat_t *sr_stat)
95 {
96  memset(sr_stat,0,sizeof(rtcp_sr_stat_t));
97 }
98 
99 /** Reset RTCP RR statistics */
100 static APR_INLINE void mpf_rtcp_rr_stat_reset(rtcp_rr_stat_t *rr_stat)
101 {
102  memset(rr_stat,0,sizeof(rtcp_rr_stat_t));
103 }
104 
105 /** Reset RTP receiver statistics */
106 static APR_INLINE void mpf_rtp_rx_stat_reset(rtp_rx_stat_t *rx_stat)
107 {
108  memset(rx_stat,0,sizeof(rtp_rx_stat_t));
109 }
110 
112 
113 #endif /* MPF_RTP_STAT_H */
apr_int32_t lost
Definition: mpf_rtp_stat.h:80
Definition: mpf_rtp_stat.h:58
apr_uint32_t discarded_packets
Definition: mpf_rtp_stat.h:46
#define APT_END_EXTERN_C
Definition: apt.h:38
apr_uint32_t received_packets
Definition: mpf_rtp_stat.h:41
apr_uint32_t ssrc
Definition: mpf_rtp_stat.h:76
apr_uint32_t rtp_ts
Definition: mpf_rtp_stat.h:66
apr_uint32_t ntp_frac
Definition: mpf_rtp_stat.h:64
apr_uint32_t lsr
Definition: mpf_rtp_stat.h:86
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
apr_uint32_t invalid_packets
Definition: mpf_rtp_stat.h:43
apr_uint32_t dlsr
Definition: mpf_rtp_stat.h:88
Definition: mpf_rtp_stat.h:39
Definition: mpf_rtp_stat.h:74
apr_uint32_t jitter
Definition: mpf_rtp_stat.h:84
Media Processing Framework Definitions.
apr_uint32_t ignored_packets
Definition: mpf_rtp_stat.h:48
apr_uint32_t lost_packets
Definition: mpf_rtp_stat.h:51
apr_uint32_t ntp_sec
Definition: mpf_rtp_stat.h:62
apr_uint32_t ssrc
Definition: mpf_rtp_stat.h:60
apr_byte_t restarts
Definition: mpf_rtp_stat.h:54
apr_uint32_t sent_octets
Definition: mpf_rtp_stat.h:70
apr_uint32_t sent_packets
Definition: mpf_rtp_stat.h:68
apr_uint32_t last_seq
Definition: mpf_rtp_stat.h:82
apr_uint32_t fraction
Definition: mpf_rtp_stat.h:78