# HG changeset patch # User Mychaela Falconia # Date 1720216671 0 # Node ID 95f6c8ce33b04dce46caea354a048b787cb2745f # Parent 32cb5a2d1178f7e33403502706f85cee69e89c06 twjit: prep for rework of time delta handling diff -r 32cb5a2d1178 -r 95f6c8ce33b0 include/twjit.h --- a/include/twjit.h Fri Jul 05 21:38:21 2024 +0000 +++ b/include/twjit.h Fri Jul 05 21:57:51 2024 +0000 @@ -91,7 +91,11 @@ /* count of RTP timestamp units per quantum */ uint32_t ts_quantum; /* quanta per second, used to scale max_future_sec */ - uint32_t quanta_per_sec; + uint16_t quanta_per_sec; + /* scaling factors for time delta conversions */ + uint16_t ts_units_per_ms; + uint32_t ts_units_per_sec; + uint32_t ns_to_ts_units; /* operational state */ enum twrtp_jibuf_state state; struct twrtp_jibuf_sub sb[2]; diff -r 32cb5a2d1178 -r 95f6c8ce33b0 src/twjit.c --- a/src/twjit.c Fri Jul 05 21:38:21 2024 +0000 +++ b/src/twjit.c Fri Jul 05 21:57:51 2024 +0000 @@ -37,6 +37,9 @@ twjit->ext_config = config; twjit->ts_quantum = (uint32_t)quantum_ms * clock_khz; twjit->quanta_per_sec = 1000 / quantum_ms; + twjit->ts_units_per_ms = clock_khz; + twjit->ts_units_per_sec = (uint32_t) clock_khz * 1000; + twjit->ns_to_ts_units = 1000000 / clock_khz; twjit->state = TWJIT_STATE_EMPTY; INIT_LLIST_HEAD(&twjit->sb[0].queue); INIT_LLIST_HEAD(&twjit->sb[1].queue); diff -r 32cb5a2d1178 -r 95f6c8ce33b0 src/twjit_in.c --- a/src/twjit_in.c Fri Jul 05 21:38:21 2024 +0000 +++ b/src/twjit_in.c Fri Jul 05 21:57:51 2024 +0000 @@ -80,7 +80,8 @@ } else { uint32_t fwd = ts_delta / twjit->ts_quantum; - if (fwd >= sb->conf.max_future_sec * twjit->quanta_per_sec) + if (fwd >= (uint32_t) sb->conf.max_future_sec * + twjit->quanta_per_sec) return INPUT_RESET; } return INPUT_CONTINUE;