BBC radio stream play sound of low quality
I recently tried to play some BBC link (provided by you in #645), for example: BBC Radio 1.
The sound quality is very good for about 1 second at the beginning of successful connection, but then it gets worse (there is always sound distortion). I checked the log and there is not any abnormal prompt.
I think the network problem (tried wired and wireless network connection) and the audio source problem (VLC/MPC plays well on PC) can be ruled out.
Is it the problem of the decoder? Or the hardware decoding capability is insufficient (I am using ESP32-S3)? Or is it just me who has this problem?
I manually downloaded the linked m3u8 content.
#EXTM3U
#EXT-X-VERSION:3
## Created with Unified Streaming Platform(version=1.8.4)
#EXT-X-MEDIA-SEQUENCE:271221806
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-TARGETDURATION:6
#USP-X-TIMESTAMP-MAP:MPEGTS=7210089888,LOCAL=2025-01-02T12:05:52Z
#EXT-X-PROGRAM-DATE-TIME:2025-01-02T12:05:52Z
#EXTINF:6.4, no desc
bbc_radio_one-audio=96000-271221806.ts
#EXTINF:6.4, no desc
bbc_radio_one-audio=96000-271221807.ts
#EXTINF:6.4, no desc
bbc_radio_one-audio=96000-271221808.ts
#EXTINF:6.4, no desc
bbc_radio_one-audio=96000-271221809.ts
#EXTINF:6.4, no desc
bbc_radio_one-audio=96000-271221810.ts
Each .ts file is 6.5 seconds play length. In my experience, ESP32-audioI2S plays audio streams with segments of more than 5 seconds better than those with segments of about 1 second. So far BBC these links are the exception.
My test is based on the Arduino framework. In addition to the audio playback task, another task is created. "audio.loop() is placed in the loop() (task priority is 0). Another task uses vTaskDelay combined with a counter to determine the end time of the beep (task priority is also 0). It is normal when playing other links. When playing the BBC link, the audio quality deteriorates and the beep time was extended distinctly.
I suspect that during the playback of the BBC link, downloading or decoding consumes extra time, which affects the FreeRTOS task switching.
I can run BBC Radio 1 without any problems. However, I do not use any other tasks.
It is possible that the ping time on "as-hls-ww-live.akamaized.net" is too long, preferably less than 100ms. For me it is 19ms.
You are right, my ping time is close to 200mS, which seems to be unsolvable for the network I am using.
Strangely, the VoA online radio station, which also has a ping time of 200mS, can be played smoothly.
It seems that there are other problems with BBC link playback.
i can play stream smoothly with this code sometime hits issue need to handle buffering
https://github.com/schreibfaul1/ESP32-audioI2S/issues/810