5
|
1 /*
|
|
2 * SpanDSP - a series of DSP components for telephony
|
|
3 *
|
|
4 * ip_network_model.h - Model an IP networks latency, jitter and loss.
|
|
5 *
|
|
6 * Written by Steve Underwood <steveu@coppice.org>
|
|
7 *
|
|
8 * Copyright (C) 2006 Steve Underwood
|
|
9 *
|
|
10 * All rights reserved.
|
|
11 *
|
|
12 * This program is free software; you can redistribute it and/or modify
|
|
13 * it under the terms of the GNU General Public License version 2, as
|
|
14 * published by the Free Software Foundation.
|
|
15 *
|
|
16 * This program is distributed in the hope that it will be useful,
|
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 * GNU General Public License for more details.
|
|
20 *
|
|
21 * You should have received a copy of the GNU General Public License
|
|
22 * along with this program; if not, write to the Free Software
|
|
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
24 *
|
|
25 * $Id: ip_network_model.h,v 1.4 2006/10/24 13:45:29 steveu Exp $
|
|
26 */
|
|
27
|
|
28 /*! \file */
|
|
29
|
|
30 /*! \page ip_network_model_page IP network path model
|
|
31 \section ip_network_model_page_sec_1 What does it do?
|
|
32 The IP network modelling module provides simple modelling of latency, jitter
|
|
33 and packet loss for a IP network media streaming path.
|
|
34
|
|
35 Right now this is extremely crude. It needs to be extended to better represent
|
|
36 the behaviour of UDP packets for RTP, UDPTL, and other streaming purposes.
|
|
37 */
|
|
38
|
|
39 #if !defined(_IP_NETWORK_MODEL_H_)
|
|
40 #define _IP_NETWORK_MODEL_H_
|
|
41
|
|
42 /*!
|
|
43 IP network model descriptor. This holds the complete state of
|
|
44 an IP network path model.
|
|
45 */
|
|
46 typedef struct
|
|
47 {
|
|
48 /*! The bulk delay of the path, in samples */
|
|
49 int bulk_delay;
|
|
50 /*! Jitter */
|
|
51 int jitter;
|
|
52 /*! Packet loss, in parts per million */
|
|
53 int packet_loss;
|
|
54
|
|
55 queue_t packet_queue;
|
|
56 int current_samples;
|
|
57 int delay[2];
|
|
58 } ip_network_model_state_t;
|
|
59
|
|
60 #ifdef __cplusplus
|
|
61 extern "C" {
|
|
62 #endif
|
|
63
|
|
64 void ip_network_model_send(ip_network_model_state_t *s,
|
|
65 int seq_no,
|
|
66 int count,
|
|
67 const uint8_t *buf,
|
|
68 int len);
|
|
69
|
|
70 int ip_network_model_get(ip_network_model_state_t *s,
|
|
71 int time_step,
|
|
72 uint8_t *msg,
|
|
73 int max_len,
|
|
74 int *seq_no);
|
|
75
|
|
76 ip_network_model_state_t *ip_network_model_init(int bulk_delay,
|
|
77 int jitter,
|
|
78 int loss);
|
|
79
|
|
80 int ip_network_model_release(ip_network_model_state_t *s);
|
|
81
|
|
82 #ifdef __cplusplus
|
|
83 }
|
|
84 #endif
|
|
85
|
|
86 #endif
|
|
87 /*- End of file ------------------------------------------------------------*/
|