aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmo-bts/rtp.h
blob: d104a6b499f98bebad219c15470292f031d79aeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef _RTP_H
#define _RTP_H

struct osmobts_lchan *lchan;

#define RTP_PT_GSM_FULL 3
#define RTP_PT_GSM_HALF 96
#define RTP_PT_GSM_EFR 97
#define RTP_PT_AMR_FULL 98
#define RTP_PT_AMR_HALF 99

struct osmobts_udp {
	struct osmobts_rtp	*rtp;
	struct osmo_fd		bfd;
	struct sockaddr_in	sin_local, sin_remote;
	struct llist_head	tx_queue;
};

struct osmobts_rtp {
	struct osmobts_lchan	*lchan;
	int			socket_created;
	struct osmobts_udp	rtp_udp, rtcp_udp;
	struct llist_head	dejitter_queue;
	int			dejitter_num;
	int			dejitter_min;
	int			dejitter_check;
	struct msgb		*last_frame;
	uint8_t			payload_type;
	uint16_t		sequence;
	uint32_t		timestamp;
	uint32_t		ssrc;
	int			voice_req;
};

int rtp_create_socket(struct osmobts_lchan *lchan, struct osmobts_rtp *rtp);
int rtp_bind_socket(struct osmobts_rtp *rtp);
int rtp_connect_socket(struct osmobts_rtp *rtp, uint32_t ip, uint16_t port);
int rtp_close_socket(struct osmobts_rtp *rtp);

struct gsm_data_frame {
	uint32_t	timestamp;
	uint8_t		payload_type;
	uint8_t		data[0];
};

#endif /* _RTP_H */