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

audiomp3.MP3Decoder hangs when file ends with partial frame #9652

Closed
eric321 opened this issue Sep 23, 2024 · 0 comments · Fixed by #9653
Closed

audiomp3.MP3Decoder hangs when file ends with partial frame #9652

eric321 opened this issue Sep 23, 2024 · 0 comments · Fixed by #9653
Labels

Comments

@eric321
Copy link

eric321 commented Sep 23, 2024

CircuitPython version

Adafruit CircuitPython 9.2.0-beta.0-9-gcda19477e4 on 2024-09-23; Raspberry Pi Pico with rp2040

(head)

Code/REPL

import audiobusio
import audiomp3
import board

audio = audiobusio.I2SOut(board.GP0, board.GP1, board.GP2)
mp3 = audiomp3.MP3Decoder(open('test-truncated.mp3', 'rb'))
print('\n\nplaying')
audio.play(mp3)
while audio.playing:
	pass
print('done')

Behavior

It never finishes playing (i.e., it doesn't print "done").

Description

test-truncated.mp3 was created using head -c59700 lib/mp3/examples/test.mp3 >test-truncated.mp3

In audiomp3_mp3file_get_buffer(), when there's partial frame at the end of the file, mp3file_find_sync_word() is happy but MP3Decode() fails with ERR_MP3_INDATA_UNDERFLOW, and things stay in this state forever.

Additional information

Will send a pull request with a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant