Commit Graph

9 Commits

Author SHA1 Message Date
Andreas Eversberg 8d65c3ff4d Add option to automatically reset RIFO on underrun/overflow
Whenever the RIFO buffer fill drifts away from its target, it can be
automatically reset and filled to the initial prefill_frame_count value.
The average fill is measured over several seconds. A given deviation
in percent of the prefill_frame_count is used to trigger that reset.
If the deviation is not set (0), this feature is deactivated.

There are two reasons for this to happen: The GPS clock is missing, so
the receiving interface is not in sync with the transmitting interface.
The delay changes significantly, due to congestion on the path between
both peers. (poor internet connection)

Change-Id: Id7ccbfbdb288990c01f185dec79a1022a68b4748
2024-01-19 18:23:01 +01:00
Christoph Lauter 632517011d Increasing max FIFO size for feature request 5875, adapting tests
Change-Id: Iae76d87cf436c80c005a2f8fce5a30f74f7e4545
2023-01-26 09:45:45 -07:00
Harald Welte 3f342ee28c 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
2022-04-20 15:50:32 +02:00
Sylvain Munaut ce817ca149 rifo_test: Use a helper function for the rifo init
Because we poke at some of the internals we need to make
sure to maintain the internal state consistent.

Signed-off-by: Sylvain Munaut <>
Change-Id: I5d9397be391c60f732c89f158d25660e1f32cfac
2022-04-20 15:48:26 +02:00
Harald Welte f226f50d12 rifo_test: print rifo_depth + rifo_frames on every IN/OUT
This shows that rifo_depth is off-by-one for all but the 'empty'
case.  It is intended that 'make check' will fail after this commit,
before the next commit with the fix is introduced.

Change-Id: I1be1889800c83d251d17801f31040c137c06a46d
2022-04-20 15:48:26 +02:00
Sylvain Munaut 2c0af2fa98 RIFO: Add a test for bounds checking
This tests exactly one frame before and one frame after what
should be accepted to make sure those are rejected

Signed-off-by: Sylvain Munaut <>
Change-Id: I048e1b8c2b918f7ca4b4327b89bf04430a2838bc
2022-04-14 20:17:14 +00:00
Sylvain Munaut 1cc564d81a RIFO: Minor typo/comment fixes
Signed-off-by: Sylvain Munaut <>
Change-Id: I9b6181f9136b7963681c472b017d005022d27e6e
2022-04-14 20:13:59 +00:00
Manawyrm c72f38feac RIFO: add more thorough tests and a vetted test.ok file
This commit adds 2 new tests:
 - too old frames (which should get dropped)
 - already correct frames (which shouldn't be touched)

In addition, every test will now be run twice.
Once at frame number 0 and once very close to the wrap-around of
the internal frame counter in order to observe the behaviour.

Change-Id: I930b4361924b2e8bcb566eb7ee64f36e06bc7745
2022-04-09 13:21:52 +02:00
Harald Welte 38b1c5d3f0 RIFO (random in, first out) for IP->E1 direction
In the past, we used a FIFO structure (first in, first out) - which
obviously cannot deal with packet re-ordering on the IP side.

This patch introduces a new "RIFO" as a replacement for the FIFO.

The RIFO is able to reconstruct E1 frame ordering by using the
reduced frame number from the TDMoIP messages, at least as long
as the related frame number range is within the current RIFO depth.

Change-Id: I22256870114cb85e4e10932554478be7061e086b
2022-04-09 13:21:49 +02:00