Improve low bandwidth audio performance and fix RTSP issues with broken PMTUD

This commit is contained in:
Cameron Gutman
2019-11-30 22:13:46 -06:00
parent c025432ad6
commit 5f5944c237
5 changed files with 7 additions and 6 deletions

View File

@@ -170,14 +170,14 @@ public class AndroidAudioRenderer implements AudioRenderer {
@Override
public void playDecodedAudio(short[] audioData) {
// Only queue up to 40 ms of pending audio data in addition to what AudioTrack is buffering for us.
if (MoonBridge.getPendingAudioFrames() < 8) {
if (MoonBridge.getPendingAudioDuration() < 40) {
// This will block until the write is completed. That can cause a backlog
// of pending audio data, so we do the above check to be able to bound
// latency at 40 ms in that situation.
track.write(audioData, 0, audioData.length);
}
else {
LimeLog.info("Too many pending audio frames: " + MoonBridge.getPendingAudioFrames());
LimeLog.info("Too much pending audio data: " + MoonBridge.getPendingAudioDuration() +" ms");
}
}