Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Patch buffers #142

wants to merge 2 commits into from

Conversation

dkaukov
Copy link
Collaborator

@dkaukov dkaukov commented Dec 20, 2024

This config seems to prevent buffer underruns.
Related to the #140

-Buffer is 3x chunk size
-We priming it with 2 chunks

@@ -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)
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2x chunk size

@dkaukov
Copy link
Collaborator Author

dkaukov commented Dec 22, 2024

Closing in favor of #149

@dkaukov dkaukov closed this Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant