webrtc-sdk / webrtc

BSD 3-Clause "New" or "Revised" License
242 stars 95 forks source link

Try to by pass audio encoder if pre-encoded set #120

Open kuba-- opened 5 months ago

kuba-- commented 5 months ago

This draft PR is an experiment to by-pass audio encoder if pre_encoded audio option was set.

kuba-- commented 5 months ago

I uncommented most of checks in AudioTransportImpl::NeedMorePlayData. I left commented the only one, which crashes our example:

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

I've also refined encoding. Made it more platform generic (instead of hardcoded big endian).

davidliu commented 5 months ago

Endian I think would work as platform generic? Checked the network code and I think it expects platform endianess anyways.

For the nChannels vs. nBytesPerSample check, is this something we can address?

kuba-- commented 5 months ago

For the nChannels vs. nBytesPerSample check, is this something we can address?

I'm not 100% sure if it has any impact on workflow (because nBytesPerSample is only used in the assert check), but I found the root cause. It's because in rust-sdks AudioDevice wrapper we have hardcoded values.

I've sent PR with fix: https://github.com/livekit/rust-sdks/pull/344