changeset 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 a3d71489672f
children 73bbe7da45cd
files sip-manual-out/main.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/sip-manual-out/main.c	Fri Mar 17 17:22:42 2023 -0800
+++ b/sip-manual-out/main.c	Fri Mar 17 17:59:41 2023 -0800
@@ -159,12 +159,6 @@
 				bcopy(&cur_event_time, &next_rtp_out,
 					sizeof(struct timeval));
 				rtp_out_running = 1;
-			} else {
-				next_rtp_out.tv_usec += 20000;
-				if (next_rtp_out.tv_usec >= 1000000) {
-					next_rtp_out.tv_sec++;
-					next_rtp_out.tv_usec -= 1000000;
-				}
 			}
 			if (timercmp(&cur_event_time, &next_rtp_out, <))
 				timersub(&next_rtp_out, &cur_event_time,
@@ -194,7 +188,13 @@
 			rtp_rx_select();
 		if (FD_ISSET(rtcp_udp_fd, &fds))
 			rtcp_rx_select();
-		if (rtp_out_running && (rc == 0))
+		if (rtp_out_running && (rc == 0)) {
 			generate_rtp_packet();
+			next_rtp_out.tv_usec += 20000;
+			if (next_rtp_out.tv_usec >= 1000000) {
+				next_rtp_out.tv_sec++;
+				next_rtp_out.tv_usec -= 1000000;
+			}
+		}
 	}
 }