Skip to content

audiopump.Ring: prove an underrun is silence and a count, and an overrun a short write - #335

Merged
bdbarnett merged 1 commit into
mainfrom
test/push-ring
Oct 29, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
test/push-ring

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

A stream pushed from a network arrives late and in lumps, so the two things a Ring promises when its producer can't keep up are worth pinning on every runtime:

  • Underrun: a pull that finds less than a block hands out a whole block of silence and counts it, and the frames already queued stay for the next pull. The underrun case queues 1.5 blocks, pulls 3, and checks the first block, two blocks of silence, two underruns, 512 bytes held, then the rest in order after a top-up.
  • Overrun: a write that doesn't fit is short and counted, and a producer that keeps its remainder loses nothing. The overrun case pushes six blocks through a ring two blocks deep.

Both run in tests/pump/route_probe.py on CPython and on the MicroPython unix build, with the same digests on both. Each has a planted fault (--fault drop) added to the CI lists in test-cpython.yml and clean-build.yml; locally each one fails as it should.

No library code changes.

…run a short write

Two cases in route_probe.py, on CPython and MicroPython alike. A ring holding
a block and a half, pulled for three, gives the block, then two blocks of
silence and two underruns, and keeps the half block for the next pull. A
producer that offers its remainder again after a short write pushes six
blocks through a ring two blocks deep with nothing lost, and each short write
is counted. Each case has a planted fault in CI that must fail.
@bdbarnett
bdbarnett merged commit b4f7867 into main Oct 29, 2026
31 checks passed
@bdbarnett
bdbarnett deleted the test/push-ring branch October 29, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant