I have this Spanish station, that plays well in my webbrowser.
https://soporte.ikernet.net:6443/listen/segura_irratia/radio.mp3
But on my radioglobe it plays for a second maybe, and quits with a Ringbuffer empty.
So I did some rogue code changes, (partially) commented out two lines, left a note who did it, but no idea what I was thinking...
So now it looks like this:
void ESP32_VS1053_Stream::_chunkedStreamToRingBuffer(WiFiClient *stream)
{
[[maybe_unused]] const auto startTimeMS = millis();
size_t bytesToRingBuffer = 0;
const size_t MAX_MOVE = size() ? 2048 : 512; // everything without a size is radio so low bitrate
if (_bytesLeftInChunk
// && _musicDataPosition < _metaDataStart // Frank did this
&& xRingbufferGetCurFreeSize(_ringbuffer_handle)
&& stream->available())
{
// const size_t inStream = _metaDataStart ? _metaDataStart - _musicDataPosition : stream->available();
const size_t inStream = stream->available(); // by Frank
const size_t inChunk = min(_bytesLeftInChunk, inStream);
const size_t toMove = min(inChunk, MAX_MOVE);
const size_t toRead = min(toMove, xRingbufferGetCurFreeSize(_ringbuffer_handle));
const size_t inBuffer = stream->read(_localbuffer, toRead);
const BaseType_t result = xRingbufferSend(_ringbuffer_handle, _localbuffer, inBuffer, 0);
if (result == pdFALSE)
{
log_v("ringbuffer failed to receive %i bytes. Closing stream.", inBuffer);
if (_errorCallback)
_errorCallback(ERROR_RINGBUFFER_FAIL);
_remainingBytes = 0;
return;
}
_bytesLeftInChunk -= inBuffer;
bytesToRingBuffer += inBuffer;
_musicDataPosition += _metaDataStart ? inBuffer : 0;
}
log_d("%lu ms moving %i bytes chunked->ringbuffer", millis() - startTimeMS, bytesToRingBuffer);
}
The interesting thing is, this particular station now plays happily along. But I probably also have broken something.
A quick test, running some other stations, doesn't reveal any strange new behaviour.
Just to keep you entertained eh.
I have this Spanish station, that plays well in my webbrowser.
https://soporte.ikernet.net:6443/listen/segura_irratia/radio.mp3But on my radioglobe it plays for a second maybe, and quits with a Ringbuffer empty.
So I did some rogue code changes, (partially) commented out two lines, left a note who did it, but no idea what I was thinking...
So now it looks like this:
The interesting thing is, this particular station now plays happily along. But I probably also have broken something.
A quick test, running some other stations, doesn't reveal any strange new behaviour.
Just to keep you entertained eh.