Skip to content

Commit

Permalink
little improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
schreibfaul1 committed Feb 3, 2024
1 parent dd1afff commit cf88468
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ esp_err_t Audio::I2Sstop(uint8_t i2s_num) {
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void Audio::setDefaults() {
stopSong();
setSampleRate(16000); // ESP32-S3 -> reduce SR, if 48000Hz a connect to another URL is impossible
initInBuff(); // initialize InputBuffer if not already done
InBuff.resetBuffer();
MP3Decoder_FreeBuffers();
Expand Down
4 changes: 2 additions & 2 deletions src/opus_decoder/opus_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bool s_f_opusFramePacket = false;
bool s_f_opusStereoFlag = false;
uint8_t s_opusChannels = 0;
uint8_t s_opusCountCode = 0;
uint16_t s_opusSamplerate = 0;
uint32_t s_opusSamplerate = 0;
uint32_t s_opusSegmentLength = 0;
uint32_t s_opusBlockPicLen = 0;
uint32_t s_opusBlockPicPos = 0;
Expand Down Expand Up @@ -365,7 +365,7 @@ int parseOpusHead(uint8_t *inbuf, int nBytes){ // reference https://wiki.xiph.o
outputGain += *(inbuf + 16);
uint8_t channelMap = *(inbuf + 18);

if(channelCount == 0 or channelCount >2) return ERR_OPUS_CHANNELS_OUT_OF_RANGE;
if(channelCount == 0 || channelCount >2) return ERR_OPUS_CHANNELS_OUT_OF_RANGE;
s_opusChannels = channelCount;
if(sampleRate != 48000) return ERR_OPUS_INVALID_SAMPLERATE;
s_opusSamplerate = sampleRate;
Expand Down

0 comments on commit cf88468

Please sign in to comment.