Unverified Commit 974fa469 authored by Wolle's avatar Wolle Committed by GitHub

reduce maxFrameSize for wav

parent ed1edd2a
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* *
* Created on: Oct 26.2018 * Created on: Oct 26.2018
* *
* Version 2.0.6r * Version 2.0.6s
* Updated on: Nov 18.2022 * Updated on: Nov 21.2022
* Author: Wolle (schreibfaul1) * Author: Wolle (schreibfaul1)
* *
*/ */
...@@ -2865,16 +2865,11 @@ void Audio::processLocalFile() { ...@@ -2865,16 +2865,11 @@ void Audio::processLocalFile() {
byteCounter = 0; byteCounter = 0;
pos_stsz = 0; pos_stsz = 0;
if(m_codec == CODEC_M4A) pos_stsz = seek_m4a_stsz(&stszEntries); // returns the pos of atom stsz if(m_codec == CODEC_M4A) pos_stsz = seek_m4a_stsz(&stszEntries); // returns the pos of atom stsz
log_i("pos_stsz %x, stszEntries %d", pos_stsz, stszEntries);
return; return;
} }
(void) pos_stsz; (void) pos_stsz;
#ifdef CONFIG_IDF_TARGET_ESP32S3 availableBytes = 16 * 1024;
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);
...@@ -2891,14 +2886,16 @@ void Audio::processLocalFile() { ...@@ -2891,14 +2886,16 @@ void Audio::processLocalFile() {
byteCounter += bytesAddedToBuffer; // Pull request #42 byteCounter += bytesAddedToBuffer; // Pull request #42
InBuff.bytesWritten(bytesAddedToBuffer); InBuff.bytesWritten(bytesAddedToBuffer);
} }
if(!f_stream){ if(!f_stream){
if(m_controlCounter != 100) { if(m_controlCounter != 100) {
if(InBuff.bufferFilled() > maxFrameSize){ // read the file header first if(InBuff.bufferFilled() > maxFrameSize){ // read the file header first
InBuff.bytesWasRead(readAudioHeader(InBuff.bufferFilled())); InBuff.bytesWasRead(readAudioHeader(InBuff.bufferFilled()));
} }
return; return;
} }
# ifndef CONFIG_IDF_TARGET_ESP32S
if((InBuff.freeSpace() > maxFrameSize) && (m_file_size - byteCounter) > maxFrameSize) return;
# endif
else{ else{
f_stream = true; f_stream = true;
AUDIO_INFO("stream ready"); AUDIO_INFO("stream ready");
...@@ -2966,11 +2963,10 @@ void Audio::processLocalFile() { ...@@ -2966,11 +2963,10 @@ void Audio::processLocalFile() {
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; else if(m_codec == CODEC_FLAC) compression = 2;
compression = 6; else compression = 3;
cnt++; cnt++;
if(cnt == compression){playAudioData(); cnt = 0;} if(cnt == compression){playAudioData(); cnt = 0;}
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: Nov 18,2022 * Updated on: Nov 21,2022
* Author: Wolle (schreibfaul1) * Author: Wolle (schreibfaul1)
*/ */
...@@ -469,7 +469,7 @@ private: ...@@ -469,7 +469,7 @@ private:
std::vector<char*> m_playlistURL; // m3u8 streamURLs buffer std::vector<char*> m_playlistURL; // m3u8 streamURLs buffer
std::vector<uint32_t> m_hashQueue; std::vector<uint32_t> m_hashQueue;
const size_t m_frameSizeWav = 1024 * 8; const size_t m_frameSizeWav = 1024;
const size_t m_frameSizeMP3 = 1600; const size_t m_frameSizeMP3 = 1600;
const size_t m_frameSizeAAC = 1600; const size_t m_frameSizeAAC = 1600;
const size_t m_frameSizeFLAC = 4096 * 4; const size_t m_frameSizeFLAC = 4096 * 4;
......
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