10000 audioio_wavfile_get_buffer: returns GET_BUFFER_MORE_DATA without any data · Issue #2128 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

audioio_wavfile_get_buffer: returns GET_BUFFER_MORE_DATA without any data #2128

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

Closed
jepler opened this issue Sep 9, 2019 · 0 comments
Closed
Assignees
Labels

Comments

@jepler
Copy link
jepler commented Sep 9, 2019

When given a bad (truncated) wave file, audioio_wavefile_get_buffer can return GET_BUFFER_MORE_DATA but set buffer_length to 0.

Run till exit from #0  audioio_wavefile_get_buffer (self=0x20008280, 
    single_channel=false, channel=<optimized out>, buffer=0x20008210, 
    buffer_length=buffer_length@entry=0x2003ff74)
    at ../../shared-module/audiocore/WaveFile.c:210
0x0005e4a8 in audiosample_get_buffer (sample_obj=<optimized out>, 
    single_channel=single_channel@entry=false, channel=channel@entry=0 '\000', 
    buffer=buffer@entry=0x20008210, buffer_length=buffer_length@entry=0x2003ff74)
    at ../../shared-module/audiocore/__init__.c:110
110            return audioio_wavefile_get_buffer(file, single_channel, channel, buffer, buffer_length);
Value returned is $8 = GET_BUFFER_MORE_DATA
(gdb) p *buffer_length
$9 = 0

This has become a very bad misbehavior on my I2SOut implementation for nRF, because I keep calling it until a desired number of bytes are supplied or GET_BUFFER_DONE is returned.

Suggested fix: If 0 bytes are returned by f_read, contrary to the information in the wave file header, return GET_BUFER_DONE. I anticipate submitting a pull request for this shortly.

@jepler jepler self-assigned this Sep 9, 2019
@jepler jepler added the audio label Sep 9, 2019
@jepler jepler added this to the 5.x.x - Bug Fixes milestone Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant
0