33 *
44 * Created on: Oct 26.2018
55 *
6- * Version 2.0.6r
7- * Updated on: Nov 18 .2022
6+ * Version 2.0.6s
7+ * Updated on: Nov 21 .2022
88 * Author: Wolle (schreibfaul1)
99 *
1010 */
@@ -2865,16 +2865,11 @@ void Audio::processLocalFile() {
28652865 byteCounter = 0 ;
28662866 pos_stsz = 0 ;
28672867 if (m_codec == CODEC_M4A) pos_stsz = seek_m4a_stsz (&stszEntries); // returns the pos of atom stsz
2868- log_i (" pos_stsz %x, stszEntries %d" , pos_stsz, stszEntries);
28692868 return ;
28702869 }
28712870 (void ) pos_stsz;
28722871
2873- #ifdef CONFIG_IDF_TARGET_ESP32S3
2874- availableBytes = maxFrameSize * 4 ;
2875- #else // Audiobuffer throttle - - -
2876- availableBytes = maxFrameSize; // reduce blocksize because PSRAM is too slow
2877- #endif
2872+ availableBytes = 16 * 1024 ;
28782873
28792874 availableBytes = min (availableBytes, InBuff.writeSpace ());
28802875 availableBytes = min (availableBytes, audiofile.size () - byteCounter);
@@ -2891,14 +2886,16 @@ void Audio::processLocalFile() {
28912886 byteCounter += bytesAddedToBuffer; // Pull request #42
28922887 InBuff.bytesWritten (bytesAddedToBuffer);
28932888 }
2894-
28952889 if (!f_stream){
28962890 if (m_controlCounter != 100 ) {
2897- if (InBuff.bufferFilled () > maxFrameSize){ // read the file header first
2891+ if (InBuff.bufferFilled () > maxFrameSize){ // read the file header first
28982892 InBuff.bytesWasRead (readAudioHeader (InBuff.bufferFilled ()));
28992893 }
29002894 return ;
29012895 }
2896+ # ifndef CONFIG_IDF_TARGET_ESP32S
2897+ if ((InBuff.freeSpace () > maxFrameSize) && (m_file_size - byteCounter) > maxFrameSize) return ;
2898+ # endif
29022899 else {
29032900 f_stream = true ;
29042901 AUDIO_INFO (" stream ready" );
@@ -2966,11 +2963,10 @@ void Audio::processLocalFile() {
29662963 static uint8_t cnt = 0 ;
29672964 uint8_t compression;
29682965 if (m_codec == CODEC_WAV) compression = 1 ;
2969- if (m_codec == CODEC_FLAC) compression = 2 ;
2970- compression = 6 ;
2966+ else if (m_codec == CODEC_FLAC) compression = 2 ;
2967+ else compression = 3 ;
29712968 cnt++;
29722969 if (cnt == compression){playAudioData (); cnt = 0 ;}
2973- playAudioData ();
29742970 }
29752971 return ;
29762972}
0 commit comments