FreeCalypso > hg > themwi-interim
diff mtctest/main.c @ 6:33d8b3177540
mtctest compiles in the new environment
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 09 Jun 2024 01:55:28 +0000 |
parents | e7b192a5dee5 |
children | a902ccbf6bbc |
line wrap: on
line diff
--- a/mtctest/main.c Sun Jun 09 00:58:38 2024 +0000 +++ b/mtctest/main.c Sun Jun 09 01:55:28 2024 +0000 @@ -10,9 +10,11 @@ #include <stdlib.h> #include <syslog.h> #include <unistd.h> +#include <themwi/rtp/rtp_alloc_simple.h> extern int mtc_socket; extern int disconnect_mode; +extern struct rtp_alloc_simple rtp_info; struct timeval cur_event_time; @@ -31,7 +33,7 @@ extern char *optarg; char *from; fd_set fds; - int c; + int c, max_fd; from = 0; while ((c = getopt(argc, argv, "f:")) != EOF) { @@ -51,16 +53,23 @@ goto usage; openlog("themwi-test-mtc", 0, LOG_LOCAL5); init_setup_msg(from, argv[optind]); - obtain_dummy_rtp(); + obtain_rtp_endp(); connect_mtc_socket(); send_setup_msg(); /* main select loop */ + max_fd = mtc_socket; + if (rtp_info.gsm_rtp_fd > mtc_socket) + max_fd = rtp_info.gsm_rtp_fd; + if (rtp_info.gsm_rtcp_fd > mtc_socket) + max_fd = rtp_info.gsm_rtcp_fd; for (;;) { FD_ZERO(&fds); FD_SET(mtc_socket, &fds); + FD_SET(rtp_info.gsm_rtp_fd, &fds); + FD_SET(rtp_info.gsm_rtcp_fd, &fds); if (!disconnect_mode) FD_SET(0, &fds); - c = select(mtc_socket+1, &fds, 0, 0, 0); + c = select(max_fd+1, &fds, 0, 0, 0); if (c < 0) { if (errno == EINTR) continue; @@ -74,5 +83,9 @@ drain_stdin(); send_disconnect_req(); } + if (FD_ISSET(rtp_info.gsm_rtp_fd, &fds)) + rtp_rx_select(); + if (FD_ISSET(rtp_info.gsm_rtcp_fd, &fds)) + rtcp_rx_select(); } }