Skip to content

Commit f831684

Browse files
committed
Problem with a certain FLAC stream #902
1 parent d7a38e9 commit f831684

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/Audio.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ void Audio::setDefaults() {
368368
m_f_ts = false;
369369
m_f_m4aID3dataAreRead = false;
370370
m_f_stream = false;
371+
m_f_decode_ready = false;
371372
m_f_eof = false;
372373
m_f_ID3v1TagFound = false;
373374
m_f_lockInBuffer = false;
@@ -4359,6 +4360,7 @@ int Audio::findNextSync(uint8_t* data, size_t len) {
43594360
}
43604361
else {
43614362
if(audio_info) audio_info("syncword found at pos 0");
4363+
m_f_decode_ready = true;
43624364
}
43634365
}
43644366
if(nextSync > 0) { AUDIO_INFO("syncword found at pos %i", nextSync); }
@@ -4439,6 +4441,7 @@ int Audio::sendBytes(uint8_t* data, size_t len) {
44394441
int bytesDecoded = 0;
44404442

44414443
if(m_codec == CODEC_NONE && m_playlistFormat == FORMAT_M3U8) return 0; // can happen when the m3u8 playlist is loaded
4444+
if(!m_f_decode_ready) return 0; // find sync first
44424445

44434446
switch(m_codec) {
44444447
case CODEC_WAV: m_decodeError = 0; bytesLeft = 0; break;

src/Audio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ uint64_t bigEndian(uint8_t* base, uint8_t numBytes, uint8_t shiftLeft = 8) {
677677
bool m_f_commFMT = false; // false: default (PHILIPS), true: Least Significant Bit Justified (japanese format)
678678
bool m_f_audioTaskIsRunning = false;
679679
bool m_f_stream = false; // stream ready for output?
680+
bool m_f_decode_ready = false; // if true data for decode are ready
680681
bool m_f_eof = false; // end of file
681682
bool m_f_lockInBuffer = false; // lock inBuffer for manipulation
682683
bool m_f_audioTaskIsDecoding = false;

0 commit comments

Comments
 (0)