@@ -396,7 +396,9 @@ void ESP32_VS1053_Stream::_playFromRingBuffer()
396
396
while (_remainingBytes && _vs1053->data_request () && millis () - start < MAX_TIME_MS)
397
397
{
398
398
size_t size = 0 ;
399
+ portDISABLE_INTERRUPTS ();
399
400
uint8_t *data = (uint8_t *)xRingbufferReceiveUpTo (_ringbuffer_handle, &size, pdMS_TO_TICKS (0 ), VS1053_PLAYBUFFER_SIZE);
401
+ portENABLE_INTERRUPTS ();
400
402
if (!data)
401
403
{
402
404
log_i (" No ringbuffer data available" );
@@ -424,7 +426,9 @@ void ESP32_VS1053_Stream::_streamToRingBuffer(WiFiClient *const stream)
424
426
break ;
425
427
426
428
const int BYTES_IN_BUFFER = stream->readBytes (_localbuffer, BYTES_TO_READ);
429
+ portDISABLE_INTERRUPTS ();
427
430
const BaseType_t result = xRingbufferSend (_ringbuffer_handle, _localbuffer, BYTES_IN_BUFFER, pdMS_TO_TICKS (0 ));
431
+ portENABLE_INTERRUPTS ();
428
432
if (result == pdFALSE)
429
433
{
430
434
log_e (" ringbuffer failed to receive %i bytes. Closing stream." );
@@ -505,7 +509,9 @@ void ESP32_VS1053_Stream::_chunkedStreamToRingBuffer(WiFiClient *const stream)
505
509
break ;
506
510
507
511
const int BYTES_IN_BUFFER = stream->readBytes (_localbuffer, BYTES_TO_READ);
512
+ portDISABLE_INTERRUPTS ();
508
513
const BaseType_t result = xRingbufferSend (_ringbuffer_handle, _localbuffer, BYTES_IN_BUFFER, pdMS_TO_TICKS (0 ));
514
+ portENABLE_INTERRUPTS ();
509
515
if (result == pdFALSE)
510
516
{
511
517
log_e (" ringbuffer failed to receive %i bytes. Closing stream." );
0 commit comments