# HG changeset patch # User Mychaela Falconia # Date 1720303206 0 # Node ID 58e9719d1a842e0be05faa1fecf750b224a65122 # Parent 355de6301404b13b4d02eff00ffb0b8257d8c75c twjit: add reset function diff -r 355de6301404 -r 58e9719d1a84 include/twjit.h --- 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 */ diff -r 355de6301404 -r 58e9719d1a84 src/twjit.c --- 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)); +}