annotate include/twjit.h @ 15:355de6301404

twjit: simplify create API, factor out clock & quantum config
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 06 Jul 2024 21:31:16 +0000
parents 323957bebd53
children 58e9719d1a84
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * Themyscira Wireless jitter buffer implementation: definition of
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * structures and API functions.
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #pragma once
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdint.h>
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdbool.h>
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <osmocom/core/linuxlist.h>
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <osmocom/core/timer.h>
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 /*
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 * twjit configuration tunings, usually set via vty.
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 struct twrtp_jibuf_config {
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 /* buffer depth: starting minimum and high watermark */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 uint16_t bd_start;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 uint16_t bd_hiwat;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 /* interval for thinning of too-deep standing queue */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 uint16_t thinning_int;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 /* guard against time traveler RTP packets */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 uint16_t max_future_sec;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 /* min and max time delta in starting state, 0 means not set */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 uint16_t start_min_delta;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 uint16_t start_max_delta;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 };
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 /*
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 * Stats collected during the lifetime of a twjit instance.
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 struct twrtp_jibuf_stats {
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 /* normal operation */
11
4f82b9c07ddb twjit: update to stats
Mychaela Falconia <falcon@freecalypso.org>
parents: 9
diff changeset
35 uint32_t rx_packets;
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 uint32_t delivered_pkt;
11
4f82b9c07ddb twjit: update to stats
Mychaela Falconia <falcon@freecalypso.org>
parents: 9
diff changeset
37 uint32_t handovers_in;
4f82b9c07ddb twjit: update to stats
Mychaela Falconia <falcon@freecalypso.org>
parents: 9
diff changeset
38 uint32_t handovers_out;
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 /* undesirable, but not totally unexpected */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 uint32_t too_old;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 uint32_t underruns;
12
323957bebd53 twjit: smarter counting of underruns
Mychaela Falconia <falcon@freecalypso.org>
parents: 11
diff changeset
42 uint32_t ho_underruns;
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 uint32_t output_gaps;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 uint32_t thinning_drops;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 /* unusual error events */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 uint32_t bad_packets;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 uint32_t duplicate_ts;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 /* independent analysis of Rx packet stream */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 uint32_t ssrc_changes;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 uint32_t seq_skips;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 uint32_t seq_backwards;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 uint32_t seq_repeats;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 uint32_t intentional_gaps;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 uint32_t ts_resets;
11
4f82b9c07ddb twjit: update to stats
Mychaela Falconia <falcon@freecalypso.org>
parents: 9
diff changeset
55 uint32_t jitter_max;
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 };
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 /*
9
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
59 * Info collected from the incoming RTP data stream
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
60 * for the purpose of generating RTCP reception report blocks.
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
61 */
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
62 struct twrtp_jibuf_rr_info {
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
63 uint32_t rx_packets;
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
64 uint32_t base_seq;
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
65 uint32_t max_seq_ext;
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
66 uint32_t expected_pkt;
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
67 uint32_t jitter_accum;
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
68 };
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
69
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
70 /*
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 * Each twjit instance has two sub-buffers; each subbuf is a queue of
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 * received RTP packets that have the same SSRC and whose timestamps
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 * increment in the expected cadence, with each ts delta being an
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 * integral multiple of the samples-per-quantum constant.
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 struct twrtp_jibuf_sub {
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 uint32_t ssrc;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 uint32_t head_ts;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 struct llist_head queue;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 uint32_t depth;
9
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
81 uint32_t delta_ms; /* used only in starting state */
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 /* thinning mechanism */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 uint16_t drop_int_count;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 /* running config for this subbuf */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 struct twrtp_jibuf_config conf;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 };
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 /*
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 * Each twjit instance is in one of 4 fundamental states at any moment,
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 * as enumerated here.
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 enum twrtp_jibuf_state {
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 TWJIT_STATE_EMPTY,
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 TWJIT_STATE_HUNT,
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 TWJIT_STATE_FLOWING,
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 TWJIT_STATE_HANDOVER,
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 };
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 /* Main structure for one instance of twjit */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 struct twrtp_jibuf_inst {
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 /* pointer to config structure given to twrtp_jibuf_create(),
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 * memory must remain valid, but content can change at any time. */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 struct twrtp_jibuf_config *ext_config;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 /* count of RTP timestamp units per quantum */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 uint32_t ts_quantum;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 /* quanta per second, used to scale max_future_sec */
8
95f6c8ce33b0 twjit: prep for rework of time delta handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
107 uint16_t quanta_per_sec;
95f6c8ce33b0 twjit: prep for rework of time delta handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
108 /* scaling factors for time delta conversions */
95f6c8ce33b0 twjit: prep for rework of time delta handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
109 uint16_t ts_units_per_ms;
95f6c8ce33b0 twjit: prep for rework of time delta handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
110 uint32_t ts_units_per_sec;
95f6c8ce33b0 twjit: prep for rework of time delta handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
111 uint32_t ns_to_ts_units;
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 /* operational state */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 enum twrtp_jibuf_state state;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 struct twrtp_jibuf_sub sb[2];
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 uint8_t read_sb; /* 0 or 1 */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 uint8_t write_sb; /* ditto */
9
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
117 /* info about the most recent Rx packet */
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 uint32_t last_ssrc;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 uint32_t last_ts;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 uint16_t last_seq;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 bool got_first_packet;
9
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
122 struct timespec last_arrival;
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
123 uint32_t last_arrival_delta;
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
124 /* analytics for RTCP RR */
117fa99ff871 twjit: implement proper analytics
Mychaela Falconia <falcon@freecalypso.org>
parents: 8
diff changeset
125 struct twrtp_jibuf_rr_info rr_info;
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 /* stats over lifetime of this instance */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 struct twrtp_jibuf_stats stats;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 };
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 /* twjit module API functions */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131
15
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
132 struct twrtp_jibuf_inst *
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
133 twrtp_jibuf_create(void *ctx, struct twrtp_jibuf_config *config);
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
134
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
135 /*
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
136 * The default timescale is 8 kHz (8000 samples per second),
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
137 * and the default quantum duration (packetization interval) is 20 ms.
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
138 * The following function can be used to change these fundamental
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
139 * parameters; it may be called only right after twrtp_jibuf_create(),
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
140 * before any packets are fed to twrtp_jibuf_input().
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
141 */
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
142 void twrtp_jibuf_set_ts_quant(struct twrtp_jibuf_inst *twjit,
355de6301404 twjit: simplify create API, factor out clock & quantum config
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
143 uint16_t clock_khz, uint16_t quantum_ms);
3
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 void twrtp_jibuf_destroy(struct twrtp_jibuf_inst *twjit);
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 struct msgb;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 /* RTP input, takes ownership of msgb */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 void twrtp_jibuf_input(struct twrtp_jibuf_inst *twjit, struct msgb *msg);
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 /* output function, to be called by TDM/GSM/etc fixed-timing side */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 struct msgb *twrtp_jibuf_output(struct twrtp_jibuf_inst *twjit);
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 /* vty configuration functions */
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 void twrtp_jibuf_init_defaults(struct twrtp_jibuf_config *config);
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 void twrtp_jibuf_vty_init(int twjit_node);
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 struct vty;
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 int twrtp_jibuf_config_write(struct vty *vty,
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 const struct twrtp_jibuf_config *conf,
d10ea5dc61b3 twjit: initial import from previous work repository
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 const char *name, const char *prefix);