changeset 16:58e9719d1a84

twjit: add reset function
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 06 Jul 2024 22:00:06 +0000
parents 355de6301404
children 2a24487453a7
files include/twjit.h src/twjit.c
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/include/twjit.h	Sat Jul 06 21:31:16 2024 +0000
+++ b/include/twjit.h	Sat Jul 06 22:00:06 2024 +0000
@@ -144,6 +144,8 @@
 
 void twrtp_jibuf_destroy(struct twrtp_jibuf_inst *twjit);
 
+void twrtp_jibuf_reset(struct twrtp_jibuf_inst *twjit);
+
 struct msgb;
 
 /* RTP input, takes ownership of msgb */
--- a/src/twjit.c	Sat Jul 06 21:31:16 2024 +0000
+++ b/src/twjit.c	Sat Jul 06 22:00:06 2024 +0000
@@ -61,3 +61,14 @@
 	twjit->ts_units_per_sec = (uint32_t) clock_khz * 1000;
 	twjit->ns_to_ts_units = 1000000 / clock_khz;
 }
+
+void twrtp_jibuf_reset(struct twrtp_jibuf_inst *twjit)
+{
+	msgb_queue_free(&twjit->sb[0].queue);
+	msgb_queue_free(&twjit->sb[1].queue);
+	twjit->state = TWJIT_STATE_EMPTY;
+	twjit->sb[0].depth = 0;
+	twjit->sb[1].depth = 0;
+	twjit->got_first_packet = false;
+	memset(&twjit->stats, 0, sizeof(struct twrtp_jibuf_stats));
+}