Skip to content

test #764: add unit tests for LatencyTuner#835

Closed
Ayoub-glitsh wants to merge 2 commits into
roc-streaming:masterfrom
Ayoub-glitsh:feat/764-latency-tuner-tests
Closed

test #764: add unit tests for LatencyTuner#835
Ayoub-glitsh wants to merge 2 commits into
roc-streaming:masterfrom
Ayoub-glitsh:feat/764-latency-tuner-tests

Conversation

@Ayoub-glitsh
Copy link
Copy Markdown

Closes #764

Added unit tests for LatencyTuner in isolation (test_latency_tuner.cpp).

Tests cover the main scenarios from the issue:

valid/invalid initialization
bounds checking in bounds, out of bounds, stalling suppression, no data yet
scaling direction and clamping
E2E backend behavior
No build changes needed, test files are picked up automatically.

The --rate flag only sets the input device sample rate, but the packet
encoding defaults to L16_Stereo at 44100 Hz. When input rate differs
from packet encoding rate, the sender creates a resampler even if the
user doesn't want one.

Add --packet-encoding option that lets users register a custom RTP
encoding and select it for outgoing packets. This allows sending at
48kHz (or any rate) without resampling:

  roc-send --rate=48000 --packet-encoding=96:s16/48000/stereo ...

The option accepts the format '<id>:<format>/<rate>/<channels>', e.g.:
  96:s16/48000/stereo
  97:s16/48000/mono

The encoding is registered in the context encoding map and the sender
is configured to use it as the packet encoding.
Tests cover:
- Initialization: valid/invalid configs, intact vs tuning profiles
- Bounds checking: latency at target, above max, below min, stalling
  suppression, no-metrics-yet behavior, intact profile ignores bounds
- Scaling: no scaling before first interval, near-1.0 at target,
  above-1.0 when latency high, below-1.0 when latency low, clamped
  to scaling_tolerance, intact profile never produces scaling
- E2E backend: no update without e2e metrics, terminates on out-of-bounds
@rocstreaming-bot rocstreaming-bot added the contrib PR not by a maintainer label Apr 24, 2026
@rocstreaming-bot
Copy link
Copy Markdown

🤖 Pull request is not targeted to develop branch, which is usually wrong.
If this was not intentional, please rebase on fresh develop branch, force-push, and re-target pull request using github web interface. Remember to use rebase with force-push instead of regular merge.

@baranovmv
Copy link
Copy Markdown
Member

baranovmv commented Apr 25, 2026

Hi @Ayoub-glitsh ! I love this PR, thx for your efforts

I haven't been able to look onto the code itself, here are some general comments:

  1. remove irrelevant changes which sneaked into from fix #807: add --packet-encoding option to roc-send #834
  2. target branch must be develop, not master
  3. please don't use dashes as logic delimiters, bring the test file code style into consistency with the others.
  4. before you manage to pass the tests, please make draft, not an open pr

@Ayoub-glitsh Ayoub-glitsh closed this by deleting the head repository Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contrib PR not by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests for dynamic latency and related metrics

3 participants