FreeCalypso > hg > themwi-rtp-lib
changeset 8:95f6c8ce33b0
twjit: prep for rework of time delta handling
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 05 Jul 2024 21:57:51 +0000 |
parents | 32cb5a2d1178 |
children | 117fa99ff871 |
files | include/twjit.h src/twjit.c src/twjit_in.c |
diffstat | 3 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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];
--- 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);
--- 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;