VS1053 gets stuck playing this AAC file

Writing software that inputs and/or outputs audio and performs DSP algorithms such as filters, new codecs or audio effects.
Post Reply
mj_pic
User
Posts: 2
Joined: Sun 2022-12-11 16:27

VS1053 gets stuck playing this AAC file

Post by mj_pic »

I am making a web radio using VS1053 and the code base is built on the key parts of edzelf's ESP8266+VS1053 internet radio. My ESp8266 code is working well with stations that stream either in mp3 or in mpeg ts (Transport Stream).

But there are a family of stations that stream in ADTS AAC and I am struggling to get the AAC file play. Using curl on Linux, I piped one stream of 10 seconds to a disk file (data is stored as ADTS aac format). It plays perfectly on Linux in Celluloid application (the default media player on my Linux Mint). ffmpeg and ffplay also correctly decode and play this file. However, the same file when sent to VS1053 plays for about the 1st half or one second and then locks up. On debugging it is seen that after about 4224 bytes have been sent to the VS1053 in chunks of 32 bytes, the VS1053 DREQ pin stays high forever from that point onwards. Different streams from these stations block at different places - some right in the beginning. Interestingly, the same file fails to play in Windows 7 Media Player (no error).

I found another aac file (from another source) and that plays perfectly on the VS1053 (and also on the Win7 media player). Using ffprobe, I can see that the problematic aac format is HE-AACV2, stereo add at 31kb/s bitrate. The aac file that plays well has format HE-AAC, stero at 65kb/s bitrate.
I have tried various clock rates & multipliers, but no luck. All the ADTS packets are in order (though I have no clue if the AAC frames within the ADTS packets are well formed or not). I can't understand why the VS1053 should lock up, if the format is corrupted, it could hae just discarded the packets.

I am attaching both the problematic & good aac files. Please help, I have been struggling for several days trying to solve this.
Attachments
problematic.aac
(38.17 KiB) Downloaded 126 times
good.aac
(598.74 KiB) Downloaded 107 times
User avatar
pasi
VLSI Staff
Posts: 2102
Joined: Thu 2010-07-15 16:04

Re: VS1053 gets stuck playing this AAC file

Post by pasi »

Hello,

The problem file seems to be decoded correctly with the vs1053b-patches package loaded (and locks the decoder without).

You can find the vs1053b patches package from: https://www.vlsi.fi/en/support/software ... tches.html .

-Pasi
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
mj_pic
User
Posts: 2
Joined: Sun 2022-12-11 16:27

Re: VS1053 gets stuck playing this AAC file

Post by mj_pic »

Thank you very much Pasi. I used the last 2 weeks figuring out how to load the vs1053b-patches-flac-latm.pg file and now successfully loaded it. Now the aac stream works perfectly!
Post Reply