FreeCalypso > hg > themwi-rtp-lib
changeset 12:323957bebd53
twjit: smarter counting of underruns
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 06 Jul 2024 02:47:21 +0000 |
parents | 4f82b9c07ddb |
children | 19367028cc6e |
files | include/twjit.h src/twjit_in.c src/twjit_out.c |
diffstat | 3 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/include/twjit.h Sat Jul 06 01:57:52 2024 +0000 +++ b/include/twjit.h Sat Jul 06 02:47:21 2024 +0000 @@ -39,6 +39,7 @@ /* undesirable, but not totally unexpected */ uint32_t too_old; uint32_t underruns; + uint32_t ho_underruns; uint32_t output_gaps; uint32_t thinning_drops; /* unusual error events */
--- a/src/twjit_in.c Sat Jul 06 01:57:52 2024 +0000 +++ b/src/twjit_in.c Sat Jul 06 02:47:21 2024 +0000 @@ -218,6 +218,7 @@ void twrtp_jibuf_input(struct twrtp_jibuf_inst *twjit, struct msgb *msg) { + bool got_previous_input = twjit->got_first_packet; struct rtp_basic_hdr *rtph; uint32_t rx_ssrc, rx_ts; uint16_t rx_seq; @@ -236,7 +237,7 @@ rx_ts = ntohl(rtph->tstamp); rx_seq = ntohs(rtph->seq); osmo_clock_gettime(CLOCK_MONOTONIC, &now); - if (!twjit->got_first_packet) { + if (!got_previous_input) { analytics_init(twjit, rx_seq); twjit->got_first_packet = true; } else if (rx_ssrc != twjit->last_ssrc) { @@ -254,6 +255,8 @@ switch (twjit->state) { case TWJIT_STATE_EMPTY: /* first packet into totally empty buffer */ + if (got_previous_input) + twjit->stats.underruns++; twjit->state = TWJIT_STATE_HUNT; twjit->write_sb = 0; init_subbuf_first_packet(twjit, msg, rx_ssrc, rx_ts);
--- a/src/twjit_out.c Sat Jul 06 01:57:52 2024 +0000 +++ b/src/twjit_out.c Sat Jul 06 02:47:21 2024 +0000 @@ -91,7 +91,6 @@ case TWJIT_STATE_FLOWING: if (read_sb_is_empty(twjit)) { twjit->state = TWJIT_STATE_EMPTY; - twjit->stats.underruns++; return NULL; } read_sb_thinning(twjit); @@ -106,7 +105,7 @@ } if (read_sb_is_empty(twjit)) { twjit->state = TWJIT_STATE_HUNT; - twjit->stats.underruns++; + twjit->stats.ho_underruns++; return NULL; } read_sb_thinning(twjit);