livekit: Audio tracks do not support stereo sound
Describe the bug When using LiveKit, at least with the Javascript SDK, received audio tracks are always downsampled to mono, regardless of how they are sent.
I would like to use LiveKit for some higher-quality audio purposes. For this, I think some changes may be needed to allow the audio quality to be controlled either by server configurations, or preferably client-side.
Server
- Version: [1.2.0]
- Environment: Docker image VPS hosted & local dev
Client
- SDK: js
- Version: 1.3.0
To Reproduce Steps to reproduce the behavior:
- two clients are connected to room
- One client publishes an audio track, specifying AudioCaptureOptions and TrackPublishOptions:
<track>.mediaStreamTrack.getSettings()
AudioCaptureOptions = {
autoGainControl: false,
echoCancellation: false,
noiseSuppression: false,
channelCount: 2,
}
TrackPublishOptions = {
audioBitrate: 256_000,
};
- 2nd client receives the track
- Validate on the sending side that two channels are being captured:
<track>.mediaStreamTrack.getSettings()
{
"autoGainControl": false,
"channelCount": 2,
"deviceId": "web-contents-media-stream://2884:4",
"echoCancellation": false,
"latency": 0.042666,
"noiseSuppression": false,
"sampleRate": 48000,
"sampleSize": 16
}
- See that on the receiving side, only a single channel is received:
{
"channelCount": 1,
"deviceId": "TR_Asstr5zE4jUefc",
"latency": 0.01,
"sampleRate": 48000,
"sampleSize": 16
}
Expected behavior If a track is published as stereo audio, it should also be received as such.
Screenshots N/A
Additional context
I think at least part of this is coming from the fact that the SDPFmtpLine is not specifying stereo=1 here: https://github.com/livekit/livekit/blob/1371108a46ac090d9ae24bea012650e70086ee10/pkg/rtc/mediaengine.go#L13, though there may be more changes needed, especially to support the new opus/red codec. It may also be helpful to add maxaveragebitrate=510000 to ensure the maximum bitrate can be allowed.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 24 (19 by maintainers)
reopening so we could take another look. if there isn’t a way to accomplish this on the server side, then we can pursue the client path.