annotate mtctest/rtp_sink.c @ 11:aa2ba9b432af

mtctest: implement play and play-stop commands
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 09 Jun 2024 04:32:57 +0000
parents 33d8b3177540
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement our RTP handling: obtaining a GSM-side
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * RTP endpoint from themwi-rtp-mgr, then handling read select on RTP
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * and RTCP UDP sockets.
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <sys/types.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <sys/socket.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <netinet/in.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdio.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <stdint.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <stdlib.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <string.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include <strings.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #include <themwi/rtp/rtp_alloc_if.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include <themwi/rtp/rtp_alloc_simple.h>
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 struct rtp_alloc_simple rtp_info;
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 void
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 obtain_rtp_endp()
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 int rc;
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 rc = rtp_alloc_simple(RTP_ALLOC_TYPE_GSM, &rtp_info);
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 if (rc < 0)
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 exit(1); /* error msg already printed */
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 }
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 void
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 rtp_rx_select()
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 {
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 u_char buf[512];
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 recv(rtp_info.gsm_rtp_fd, buf, sizeof buf, 0);
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 }
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 void
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 rtcp_rx_select()
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 {
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 u_char buf[512];
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 recv(rtp_info.gsm_rtcp_fd, buf, sizeof buf, 0);
33d8b3177540 mtctest compiles in the new environment
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 }