opentok / opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.
https://tokbox.com/developer/sdks/android/
MIT License
211 stars 169 forks source link

Disable all audio input preprocessing #376

Closed deermichel closed 3 years ago

deermichel commented 3 years ago

In our app, we try to stream high-res audio from an audio interface that is directly connected to the phone. Therefore, we need to disable all automatically applied voice/videoconference input preprocessing. On iOS this can simply be achieved by setting an appropriate category & mode for the AVAudioSession. However, on Android we're unable to get the same high-res audio quality as on iOS. We tried out different audio recording apps to confirm that the interface itself is capable of delivering high-res audio on Android (which is the case).

Things we tried so far (on a Samsung Galaxy S20 & a LG G7, both running Android 10) - using the AdvancedAudioDriver sample as a starting point:

There's definitely a noticeable improvement compared to using the default audio driver, but still the audio is not as clear (high frequencies are missing, sounds really compressed - even at a bitrate > 128k) as delivered by the interface / on iOS. I suspect that there's still some processing going on in the background that cannot be disabled by the above measures. Did someone encounter the same problem before - or does the Android OpenTok framework offer a lower quality than the iOS version in general?

igorwojda commented 3 years ago

It looks like there are two levels of audio processing, one done at the audio driver level and another done at webrtc. By doing a custom audio driver you can control the first one (Echo cancelation and AGC at capturing level). For now, there is no way to configure the second part (webrtc).

We will take a look, but I wonder if you can you provide a small sample app (just to make sure we are testing the right thing)?

igorwojda commented 3 years ago

I will close this for now. Feel free to reopen with more details.

deermichel commented 3 years ago

Hey @igorwojda, sorry for answering so late... I'm quite busy right now. I'll come back to this issue as soon as I can provide you an example app (most likely the Android Custom Audio Driver sample with the adjustmentments mentioned above).

But I was wondering where you got the information about the two levels of audio processing (on native level & in webrtc)? I thought all the audio capturing and networking stuff is done in Java? If not, is there a way to intervene on WebRTC level? Thank you :)