aethersdr / aethersdr/AetherSDR

TxVoiceProcessor runs two egress resamplers to produce identical L/R output

Open
#5,015 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

audio enhancement maintainer-review priority: low
Dominant language
C++
Stars
221
Forks
117
Avg merge
2d 7h
Merged PRs (30d)
299

Description

Follow-up from PR #4875 (48 kHz TX voice refactor), finding 6 of @jensenpat's review. Deferred there because collapsing the pair would narrow a public contract; recorded here for that discussion.

The observation

TxVoiceProcessor runs two independent r8brain instances for the 48 → 24 kHz egress conversion, one per channel:

std::unique_ptr<Resampler> m_outputLeftResampler;
std::unique_ptr<Resampler> m_outputRightResampler;

On the production mic path the two inputs are byte-identical by construction: processCapturedInt16() collapses capture to a canonical mono signal and duplicates it to L/R, and nothing in the strip decorrelates the channels. ClientReverb does not — its 23-sample stereo spread is allocation headroom, not active decorrelation, and #4875 corrected the header comment that implied otherwise.

So the most expensive DSP in the block runs twice to produce the same numbers. CPU and memory only — it cannot reduce latency, since the two run in parallel and contribute one group delay.

Measured context from #4875: the full strip costs under 1% of one core, so this is not urgent.

Why it is not a trivial deletion

processFloat48() is a public entry point that accepts arbitrary interleaved stereo, not necessarily duplicated mono. Collapsing to a single resampler would either narrow that contract or require a runtime "are these identical?" check on the audio thread.

Related: reconcileEgressFrameCounts() and its recovery path exist solely to handle the two instances disagreeing on frame count — a condition that cannot arise with one resampler. Removing the pair would let that machinery go too.

Decision needed

Either narrow processFloat48()'s contract to duplicated-mono and use one resampler, or keep the pair and accept the cost as the price of a genuinely stereo-capable seam.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TxVoiceProcessor::processFloat48() and processCapturedInt16(), then inspect m_outputLeftResampler, m_outputRightResampler, and reconcileEgressFrameCounts(). Resolve whether processFloat48() should guarantee duplicated-mono input or retain arbitrary stereo support; done means documenting and implementing the chosen contract, including the recovery-path consequences.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.