diff --git a/src/Audio.cpp b/src/Audio.cpp index 4a13b0e7..63d1c8cb 100644 --- a/src/Audio.cpp +++ b/src/Audio.cpp @@ -368,6 +368,7 @@ void Audio::setDefaults() { m_f_ts = false; m_f_m4aID3dataAreRead = false; m_f_stream = false; + m_f_decode_ready = false; m_f_eof = false; m_f_ID3v1TagFound = false; m_f_lockInBuffer = false; @@ -4359,6 +4360,7 @@ int Audio::findNextSync(uint8_t* data, size_t len) { } else { if(audio_info) audio_info("syncword found at pos 0"); + m_f_decode_ready = true; } } if(nextSync > 0) { AUDIO_INFO("syncword found at pos %i", nextSync); } @@ -4439,6 +4441,7 @@ int Audio::sendBytes(uint8_t* data, size_t len) { int bytesDecoded = 0; if(m_codec == CODEC_NONE && m_playlistFormat == FORMAT_M3U8) return 0; // can happen when the m3u8 playlist is loaded + if(!m_f_decode_ready) return 0; // find sync first switch(m_codec) { case CODEC_WAV: m_decodeError = 0; bytesLeft = 0; break; diff --git a/src/Audio.h b/src/Audio.h index 2e61b873..83aad8e7 100644 --- a/src/Audio.h +++ b/src/Audio.h @@ -677,6 +677,7 @@ uint64_t bigEndian(uint8_t* base, uint8_t numBytes, uint8_t shiftLeft = 8) { bool m_f_commFMT = false; // false: default (PHILIPS), true: Least Significant Bit Justified (japanese format) bool m_f_audioTaskIsRunning = false; bool m_f_stream = false; // stream ready for output? + bool m_f_decode_ready = false; // if true data for decode are ready bool m_f_eof = false; // end of file bool m_f_lockInBuffer = false; // lock inBuffer for manipulation bool m_f_audioTaskIsDecoding = false;