-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Hi, I love the baldam exemple web radio. I built 3 of them. Unfortunately I have 2 problems with this code, especially with French radio station:
- a particular station is difficult to connect, when I'm lucky it is connected but after a while it is definitively disconnected. It is
http://live02.rfi.fr/rfiafrique-64.mp3 - other stations well start, but after a dozen of seconds have many glitches, until they make the device aborting. they are for instance (64K / 128K):
http://icecast.radiofrance.fr/franceinter-lofi.mp3 or http://icecast.radiofrance.fr/franceinter-midfi.mp3
http://icecast.radiofrance.fr/franceculture-lofi.mp3 or http://icecast.radiofrance.fr/franceculture-midfi.mp3
https://icecast.radiofrance.fr/fip-lofi.mp3 or https://icecast.radiofrance.fr/fip-midfi.mp3
I have spent may be an hundred of hours to try to solve this problem. I thank wmarkow and fabitom for their help. In #51 they tried several workarounds like round buffer, but are mostly incomprehensible for my basic level of programming. But I learnt the following:
The glitches are due to \r\nX\r\n sequences, and then it looks like the streaming is chunked.
Works had been done to suppress these chunk messages, see #48, but I still have glitches for these particular French radios. Moreover, wmarkow and fabitom confirm that their codes are working well for themselves, but not for me :(
There is not many information about chunked transfer data, except this https://en.wikipedia.org/wiki/Chunked_transfer_encoding
When you read in detail, follow the links, you will find that chunked data stream is mostly for video transfer, here it is sound only, so I'm wondering if these chunks are not fake.... AND chunked transfer is only supported for HTTP1.1. Not in HTTP1.0
EUREKA !
@baldram I suggest to replace:
client.print(String("GET ") + path + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n\r\n");
with:
client.print(String("GET ") + path + " HTTP/1.0\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n\r\n");
It is a miracle: no more glitches, no lost stations, everything is fine now :)