Closed ghost closed 3 years ago
It looks more like the stream will break. In processWebStream() availableBytes will become zero
@schreibfaul1 Hi, I thank you for the quick response. Are you believing that the problem is with the link in the stream ??
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm hoping it's ok to leave a message on stale/wontfix issues.
I was using this library as part of an ESPHome project (github.com/smithjacobj/dementia-radio-muse-luxe) and ran into this problem repeatedly. I don't have a device with JTAG access so I haven't been able to break down the issue more, but there's a race condition somewhere that corrupts m_datamode
resetting it to AUDIO_NONE
, seeming to be somewhere in the hot loop in playSample
. Some of the serial debugging logging I did in lieu of JTAG fixed the issue (because I used mutexes to validate the memory state of my logging vars) but hasn't actually pinpointed where the race condition is caused. I tried only wrapping m_datamode
in a std::atomic
but that doesn't resolve it, but also wrapping m_curSample
fixed it. I wrapped m_validSamples
for good measure.
So far, I have not been able to observe this behaviour in my test environments. But it is conceivable in systems with multiple tasks. I don't use ESPHome, but I want there to be no problems there either. I have implemented your suggestion in the "Arduino V3.0" branch, which will become the master in the upcoming stable Arduino 3.0x version.
Cool, I hope it helps, but as I haven't been able to do proper tooled debugging, it may just be a Band-Aid that gets called often enough to enforce memory ordering on something else.
Hello, I'm using an ESP32 with PSRAM, when I play a stream after some time it stops, below I leave the log to see if anyone can help me.
It seems to me that the buffer is not filled with data again