diff options
author | Harald Welte <laforge@osmocom.org> | 2022-04-19 22:56:39 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2022-04-20 15:50:32 +0200 |
commit | 3f342ee28c697f3d2fe6ef1df518d3efb08b8a33 (patch) | |
tree | 52c0f3e0f67e5ca240493f3042cdd3907d9f13c7 /src | |
parent | d413cbcb4b7a20d209362e6d2b3703ed08fedbbe (diff) |
octoi: differentiate UNDERRUN from SUBSTITUTED in counters
A real _underrun_ happens if the RIFO is empty (depth == 0)
and should be counted different from a mere frame substition
due to packet loss.
Change-Id: I5448430b09ec10a16decdfd0a4a40850fe2ed1a6
Diffstat (limited to 'src')
-rw-r--r-- | src/octoi/e1oip.c | 3 | ||||
-rw-r--r-- | src/octoi/e1oip.h | 1 | ||||
-rw-r--r-- | src/octoi/frame_rifo.c | 9 | ||||
-rw-r--r-- | src/octoi/octoi.c | 8 |
4 files changed, 16 insertions, 5 deletions
diff --git a/src/octoi/e1oip.c b/src/octoi/e1oip.c index 6a5a240..38a22b5 100644 --- a/src/octoi/e1oip.c +++ b/src/octoi/e1oip.c @@ -44,7 +44,8 @@ #include "e1oip.h" static const struct rate_ctr_desc iline_ctr_description[] = { - [LINE_CTR_E1oIP_UNDERRUN] = { "e1oip:underrun", "Frames missing/substituted in IP->E1 direction"}, + [LINE_CTR_E1oIP_UNDERRUN] = { "e1oip:underrun", "Frames underrun / slipped in IP->E1 direction"}, + [LINE_CTR_E1oIP_SUBSTITUTED] = { "e1oip:substituted", "Frames substituted in IP->E1 direction"}, [LINE_CTR_E1oIP_OVERFLOW] = { "e1oip:overflow", "Frames overflowed in IP->E1 direction"}, [LINE_CTR_E1oIP_RX_OUT_OF_ORDER] = { "e1oip:rx:pkt_out_of_order", "Packets out-of-order in IP->E1 direction"}, [LINE_CTR_E1oIP_RX_OUT_OF_WIN] = { "e1oip:rx:pkt_out_of_win", "Packets out-of-rx-window in IP->E1 direction"}, diff --git a/src/octoi/e1oip.h b/src/octoi/e1oip.h index 99b88f0..c992622 100644 --- a/src/octoi/e1oip.h +++ b/src/octoi/e1oip.h @@ -15,6 +15,7 @@ enum e1oip_line_ctr { LINE_CTR_E1oIP_UNDERRUN, + LINE_CTR_E1oIP_SUBSTITUTED, LINE_CTR_E1oIP_OVERFLOW, LINE_CTR_E1oIP_RX_OUT_OF_ORDER, LINE_CTR_E1oIP_RX_OUT_OF_WIN, diff --git a/src/octoi/frame_rifo.c b/src/octoi/frame_rifo.c index 876f023..a6cba14 100644 --- a/src/octoi/frame_rifo.c +++ b/src/octoi/frame_rifo.c @@ -132,14 +132,19 @@ int frame_rifo_in(struct frame_rifo *rifo, const uint8_t *frame, uint32_t fn) /*! pull one frames out of the RIFO. * \param rifo The RIFO from which we want to pull frames * \param out Caller-allocated output buffer - * \returns 0 on success; -1 on error (no frame available) */ + * \returns 0 on success; -1 if no frame available; -2 if RIFO depth == 0 */ int frame_rifo_out(struct frame_rifo *rifo, uint8_t *out) { uint32_t next_out_bucket = (rifo->next_out - rifo->buf) / BYTES_PER_FRAME; bool bucket_bit = bucket_bit_get(rifo, next_out_bucket); int rc = 0; - if (!bucket_bit) { + if (frame_rifo_depth(rifo) == 0) { + /* if we don't have any RIFO depth at all, our jitter buffer has + * run empty and most likely there is some fundamental clock sync problem + * somewhere. */ + rc = -2; + } else if (!bucket_bit) { /* caller is supposed to copy/duplicate previous frame */ rc = -1; } else { diff --git a/src/octoi/octoi.c b/src/octoi/octoi.c index 8585f0d..5f4c2f9 100644 --- a/src/octoi/octoi.c +++ b/src/octoi/octoi.c @@ -127,10 +127,14 @@ void octoi_peer_e1t_out(struct octoi_peer *peer, uint8_t *buf, int fts) for (int i = 0; i < fts; i++) { uint8_t *cur = buf + BYTES_PER_FRAME*i; rc = frame_rifo_out(&iline->e1t.rifo, cur); - if (rc < 0) { - iline_ctr_add(iline, LINE_CTR_E1oIP_UNDERRUN, 1); + if (rc == -1) { + iline_ctr_add(iline, LINE_CTR_E1oIP_SUBSTITUTED, 1); /* substitute with last received frame */ memcpy(cur, iline->e1t.last_frame, BYTES_PER_FRAME); + } else if (rc == -2) { + iline_ctr_add(iline, LINE_CTR_E1oIP_UNDERRUN, 1); + /* substitute with all-FF frame */ + memset(cur, 0xff, BYTES_PER_FRAME); } } iline_stat_set(iline, LINE_STAT_E1oIP_E1T_FIFO, frame_rifo_depth(&iline->e1t.rifo)); |