forked from micropython/micropython
    
        
        - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.3k
 
Closed
Labels
Description
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.