# HG changeset patch # User Mychaela Falconia # Date 1720234041 0 # Node ID 323957bebd53e5702570466ea7ced0e106c9398c # Parent 4f82b9c07ddb7551ad051e3e1a8d9c83a8872a7d twjit: smarter counting of underruns diff -r 4f82b9c07ddb -r 323957bebd53 include/twjit.h --- 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 */ diff -r 4f82b9c07ddb -r 323957bebd53 src/twjit_in.c --- 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); diff -r 4f82b9c07ddb -r 323957bebd53 src/twjit_out.c --- 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);