comparison sip-manual-out/main.c @ 196:eac3e0b6ce02

sip-manual-out: (hopefully) fix RTP output timing
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 17 Mar 2023 17:59:41 -0800
parents f8a33603288f
children
comparison
equal deleted inserted replaced
195:a3d71489672f 196:eac3e0b6ce02
157 if (!rtp_out_running) { 157 if (!rtp_out_running) {
158 printf("Starting RTP output\n"); 158 printf("Starting RTP output\n");
159 bcopy(&cur_event_time, &next_rtp_out, 159 bcopy(&cur_event_time, &next_rtp_out,
160 sizeof(struct timeval)); 160 sizeof(struct timeval));
161 rtp_out_running = 1; 161 rtp_out_running = 1;
162 } else {
163 next_rtp_out.tv_usec += 20000;
164 if (next_rtp_out.tv_usec >= 1000000) {
165 next_rtp_out.tv_sec++;
166 next_rtp_out.tv_usec -= 1000000;
167 }
168 } 162 }
169 if (timercmp(&cur_event_time, &next_rtp_out, <)) 163 if (timercmp(&cur_event_time, &next_rtp_out, <))
170 timersub(&next_rtp_out, &cur_event_time, 164 timersub(&next_rtp_out, &cur_event_time,
171 &timeout); 165 &timeout);
172 else 166 else
192 sip_socket_select(); 186 sip_socket_select();
193 if (FD_ISSET(rtp_udp_fd, &fds)) 187 if (FD_ISSET(rtp_udp_fd, &fds))
194 rtp_rx_select(); 188 rtp_rx_select();
195 if (FD_ISSET(rtcp_udp_fd, &fds)) 189 if (FD_ISSET(rtcp_udp_fd, &fds))
196 rtcp_rx_select(); 190 rtcp_rx_select();
197 if (rtp_out_running && (rc == 0)) 191 if (rtp_out_running && (rc == 0)) {
198 generate_rtp_packet(); 192 generate_rtp_packet();
193 next_rtp_out.tv_usec += 20000;
194 if (next_rtp_out.tv_usec >= 1000000) {
195 next_rtp_out.tv_sec++;
196 next_rtp_out.tv_usec -= 1000000;
197 }
198 }
199 } 199 }
200 } 200 }