-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch buffers #142
Patch buffers #142
Conversation
@@ -837,7 +839,7 @@ public void onRunError(Exception e) { | |||
} | |||
}); | |||
usbIoManager.setWriteBufferSize(90000); // Must be large enough that ESP32 can take its time accepting our bytes without overrun. | |||
usbIoManager.setReadBufferSize(4096); // Must be much larger than ESP32's send buffer (so we never block it) | |||
usbIoManager.setReadBufferSize(1024); // Must be much larger than ESP32's send buffer (so we never block it) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chunk size
@@ -667,7 +669,7 @@ private void initAudioTrack() { | |||
.setChannelMask(AudioFormat.CHANNEL_OUT_MONO) | |||
.build()) | |||
.setTransferMode(AudioTrack.MODE_STREAM) | |||
.setBufferSizeInBytes(rxMinBufferSize) | |||
.setBufferSizeInBytes(1024 * 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3x chunk size
@@ -128,7 +129,8 @@ public class RadioAudioService extends Service { | |||
|
|||
// For receiving audio from ESP32 / radio | |||
private AudioTrack audioTrack; | |||
private static final int PRE_BUFFER_SIZE = 1000; | |||
private static int audioTrackUnderrunCount = 0; | |||
private static final int PRE_BUFFER_SIZE = 1024 * 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2x chunk size
Closing in favor of #149 |
This config seems to prevent buffer underruns.
Related to the #140
-Buffer is 3x chunk size
-We priming it with 2 chunks