Compare commits

..
2 Commits
Author SHA1 Message Date
Cameron Gutman 99b53f9a6a Version 7.3 2019-05-07 20:53:12 -07:00
Cameron Gutman 8da563b280 Bound queued audio data to prevent excessive latency 2019-05-07 20:39:45 -07:00
3 changed files with 14 additions and 5 deletions

No files matched your search

+2 -2
View File
@@ -8,8 +8,8 @@ android {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
versionName "7.2.1" versionName "7.3"
versionCode = 192 versionCode = 193
} }
flavorDimensions "root" flavorDimensions "root"
@@ -168,8 +168,17 @@ public class AndroidAudioRenderer implements AudioRenderer {
} }
@Override @Override
public void playDecodedAudio(byte[] audioData) { public void playDecodedAudio(short[] audioData) {
track.write(audioData, 0, audioData.length); // Only queue up to 40 ms of pending audio data in addition to what AudioTrack is buffering for us.
if (MoonBridge.getPendingAudioFrames() < 8) {
// 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());
}
} }
@Override @Override