comparison test-fsk/rtp_rx.c @ 8:eaf0e8f81a22

test-fsk: don't feed RTP to modem Rx during ringing
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 06 Mar 2024 21:33:49 -0800
parents ba66d297fe57
children
comparison
equal deleted inserted replaced
7:6d832abad660 8:eaf0e8f81a22
17 #include "../include/pstn_defs.h" 17 #include "../include/pstn_defs.h"
18 #include "../librtpalloc/rtp_alloc_simple.h" 18 #include "../librtpalloc/rtp_alloc_simple.h"
19 19
20 extern const uint16_t pcmu_decode_table[256]; 20 extern const uint16_t pcmu_decode_table[256];
21 extern const uint16_t pcma_decode_table[256]; 21 extern const uint16_t pcma_decode_table[256];
22
23 extern int rtp_out_enable; /* misusing the flag :-( */
22 24
23 struct sockaddr_in rtp_local_addr; 25 struct sockaddr_in rtp_local_addr;
24 int rtp_udp_fd, rtcp_udp_fd; 26 int rtp_udp_fd, rtcp_udp_fd;
25 27
26 static int rtp_start_flag, rtp_bad_flag, rtp_ssrc_chg_flag; 28 static int rtp_start_flag, rtp_bad_flag, rtp_ssrc_chg_flag;
122 if (!rtp_start_flag) { 124 if (!rtp_start_flag) {
123 printf("Rx RTP stream begins with seq=%u ts=%u\n", 125 printf("Rx RTP stream begins with seq=%u ts=%u\n",
124 rtp_last_seq, rtp_last_ts); 126 rtp_last_seq, rtp_last_ts);
125 rtp_start_flag = 1; 127 rtp_start_flag = 1;
126 } 128 }
129 /* ignore early RTP during ringing, before answer supervision */
130 if (!rtp_out_enable)
131 return;
132 /* feed samples to modem Rx */
127 for (n = 0; n < FRAME_20MS; n++) 133 for (n = 0; n < FRAME_20MS; n++)
128 pcm_samples[n] = pcm_dec_table[pkt.payload[n]]; 134 pcm_samples[n] = pcm_dec_table[pkt.payload[n]];
129 process_rx_frame(pcm_samples); 135 process_rx_frame(pcm_samples);
130 } 136 }
131 137