Unverified Commit c09c3e74 authored by Wolle's avatar Wolle Committed by GitHub

reduce the block size when writing to the audio buffer

parent 3f27592f
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* *
* Created on: Oct 26.2018 * Created on: Oct 26.2018
* *
* Version 2.0.6k * Version 2.0.6l
* Updated on: Oct 22.2022 * Updated on: Nov 02.2022
* Author: Wolle (schreibfaul1) * Author: Wolle (schreibfaul1)
* *
*/ */
...@@ -2849,6 +2849,7 @@ void Audio::processLocalFile() { ...@@ -2849,6 +2849,7 @@ void Audio::processLocalFile() {
static bool f_stream; static bool f_stream;
static bool f_fileDataComplete; static bool f_fileDataComplete;
static uint32_t byteCounter; // count received data static uint32_t byteCounter; // count received data
uint32_t availableBytes = 0;
if(m_f_firstCall) { // runs only one time per connection, prepare for start if(m_f_firstCall) { // runs only one time per connection, prepare for start
m_f_firstCall = false; m_f_firstCall = false;
...@@ -2858,7 +2859,12 @@ void Audio::processLocalFile() { ...@@ -2858,7 +2859,12 @@ void Audio::processLocalFile() {
return; return;
} }
uint32_t availableBytes = maxFrameSize * 4; #ifdef CONFIG_IDF_TARGET_ESP32S3
availableBytes = maxFrameSize * 4;
#else // Audiobuffer throttle - - -
availableBytes = maxFrameSize; // reduce blocksize because PSRAM is too slow
#endif
availableBytes = min(availableBytes, InBuff.writeSpace()); availableBytes = min(availableBytes, InBuff.writeSpace());
availableBytes = min(availableBytes, audiofile.size() - byteCounter); availableBytes = min(availableBytes, audiofile.size() - byteCounter);
if(m_contentlength){ if(m_contentlength){
...@@ -2950,13 +2956,13 @@ void Audio::processLocalFile() { ...@@ -2950,13 +2956,13 @@ void Audio::processLocalFile() {
// play audio data - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // play audio data - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if(f_stream){ if(f_stream){
// static uint8_t cnt = 0; static uint8_t cnt = 0;
// uint8_t compression; uint8_t compression;
// if(m_codec == CODEC_WAV) compression = 1; if(m_codec == CODEC_WAV) compression = 1;
// if(m_codec == CODEC_FLAC) compression = 2; if(m_codec == CODEC_FLAC) compression = 2;
// compression = 6; compression = 6;
// cnt++; cnt++;
// if(cnt == compression){playAudioData(); cnt = 0;} if(cnt == compression){playAudioData(); cnt = 0;}
playAudioData(); playAudioData();
} }
return; return;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Audio.h * Audio.h
* *
* Created on: Oct 28,2018 * Created on: Oct 28,2018
* Updated on: Oct 22,2022 * Updated on: Nov 02,2022
* Author: Wolle (schreibfaul1) * Author: Wolle (schreibfaul1)
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment