MP3 comes in chunks of encoded data started by a header sequence.
Scan for it in the decoder and only pass in data that starts with
this header to avoid the burst errors
Avoids a avalanche of `lost synchronization` error reports when there
is a file error.
Also enable additional sketches on the RP2040/RP2350
Implement the renamed network client and other API changes when built
under the 3.x branch of the Arduino ESP32 core.
Disable building TSF on the ESP32, the Xtensa G++ backend bug is still there.
Minimal changes to get I2S to build under new IDF. Deprecated but
not removed, so warnings are expected but should not be fatal in
use.
Fixes#683
Because we are allocating objects totaling over 80% of the ESP8266 memory
space, we are very sensitive to memory fragmentation. While we can control
our own allocs, the IP and SDK can allocate any size, at any time, which
can cause us to not be able to find the large contiguous memory areas we need
for the codes.
Work around this by preallocating, before anything else, buffer memory and
never freeing it. Pass this memory into the codec and it will allocate from
this block and be guaranteed to always succeed.
This may fix the last of the hangs on the webradio/http streaming, which only
seemed to happen after a stop/start cycle.
All objects can have a metadata and/or status report callback once created.
They will call the source program with the parsed ID3 tag, ICY StreamTitle,
or text and numeric error ID of any interesting event. It is up to the end
application to figure out what to do with this. Normally, you'd just print
it to the LCD or Serial port. But it is possible to detect, say, a buffer
overflow and then switch to a lower bitrate stream for example.
Add a subclass of the HTTPStream that can extract the ICY metadata.
Needs to implement a callback function or parse it internally and expose
a class variable to let the UI see the current stream information.
The buffer class seems to work very well to avoid hiccups while
streaming from the web, so add it by default to the example to
make it easier for users to cut-n-paste and make it work.
AudioFileSourceBuffer allows system RAM to be used to buffer an
input file (normally just a HTTP Stream) to help avoid hiccups.
This could also be subclassed to use an external SRAM, at some
soint.
HTTPStreamer assumed the server would drop the connection when no more
data was available to be transferred from the source file.
For individual files, though, the web server will send the expected length
in the headers and leave the connection open (i.e. to recycle the connection
and accelerate web browsing). In this case, the streamer would effectively
hang waiting for more data than was being transmitted.
Now check the read data against the expected data, and also add a 0.5s
timeout no matter what to the reading.
Tested on streaming and served files, seems to work fine.
Implements a simple and stupid HTTP stream reader to allow for ShoutCast
and other MP3 radio streaming to happen. Presently seems to stutter on
128K, 44.1KHz streams, but may be better on lower bitrates.