Skip to content

Set TfStereo when publishing stereo audio sources - #1337

Open
truemagic-coder wants to merge 4 commits into
livekit:mainfrom
truemagic-coder:agent/advertise-stereo-audio-sources
Open

Set TfStereo when publishing stereo audio sources#1337
truemagic-coder wants to merge 4 commits into
livekit:mainfrom
truemagic-coder:agent/advertise-stereo-audio-sources

Conversation

@truemagic-coder

@truemagic-coder truemagic-coder commented Aug 17, 2026

Copy link
Copy Markdown

Before you submit your PR

  • I have read the contributing guidelines.
  • I have read and followed the principles regarding breaking changes, testing, and code quality.

PR description

Fixes #1018.

When a LocalAudioTrack is created from a two-channel AudioSource, the publication path does not currently include AudioTrackFeature::TfStereo in AddTrackRequest.audio_features.

As a result, the server is not told that the source is stereo.

This PR:

  • advertises TfStereo for two-channel native audio sources;
  • leaves mono sources unchanged;
  • does not infer stereo from arbitrary multichannel sources;
  • preserves TfPreconnectBuffer behavior and composes it with TfStereo;
  • leaves non-audio publication behavior unchanged;
  • adds focused regression coverage using real NativeAudioSource values;
  • adds the required patch changeset for livekit and livekit-ffi.

NativeAudioSource can represent more than two channels, but TfStereo is a stereo flag rather than a multichannel layout. Automatic stereo advertisement is therefore limited to exactly two channels.

Breaking changes

None.

MSRV

No change.

Testing

Tests cover:

  • one-channel sources do not advertise TfStereo;
  • two-channel sources advertise TfStereo;
  • three-channel sources do not automatically advertise TfStereo;
  • TfStereo and TfPreconnectBuffer compose correctly;
  • non-audio publication behavior remains unchanged;
  • the complete livekit package test suite;
  • workspace formatting.

Verification

The exact submitted commit was independently verified with FalseGreen against a frozen verification contract.

  • exactly two channels advertise TfStereo;
  • mono does not advertise TfStereo;
  • more than two channels do not imply stereo;
  • stereo composes with preconnect buffering;
  • non-audio publication behavior remains unchanged;
  • the complete livekit package test suite and workspace formatting pass;
  • the required changeset retains patch bumps for livekit and livekit-ffi;
  • 7/7 verification criteria passed;
  • verified source: 1f76ed000a2d65749c4008a24e7715c1eeca29a7.

The verification is scoped to these criteria and does not claim broader correctness of the LiveKit Rust SDK.

Async

No runtime or async behavior changes.

Assisted-by: Codex

@CLAassistant

CLAassistant commented Aug 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@truemagic-coder
truemagic-coder marked this pull request as ready for review August 17, 2026 08:33

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust SDK does not set TfStereo audio feature when publishing from stereo AudioSource

2 participants