livekit / rust-sdks

LiveKit realtime and server SDKs for Rust
https://livekit.io
Apache License 2.0
211 stars 56 forks source link

Fix hardcoded kBytesPerSample #344

Closed kuba-- closed 5 months ago

kuba-- commented 5 months ago

Hardcoded:

kBytesPerSample = 2;
kChannels = 2;

Does not follow webrtc assert in AudioTransportImpl::NeedMorePlayData:

RTC_DCHECK_EQ(sizeof(int16_t) * nChannels, nBytesPerSample);

so the fix follows the same convention as we have in webrtc AudioDeviceBuffer::RequestPlayoutData:

  const size_t bytes_per_frame = play_channels_ * sizeof(int16_t);