Skip to content

Commit

Permalink
Account for WAV 'FLLR' chunk
Browse files Browse the repository at this point in the history
Apple adds a 'FLLR' chunk to their WAV output by AVAudioRecorder app.
  • Loading branch information
jcdr428 committed Feb 6, 2024
1 parent 72d4b4e commit c37b76e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tsMuxer/lpcmStreamReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ int LPCMStreamReader::decodeWaveHeader(uint8_t* buff, uint8_t* end)
if (end - buff < 20)
return NOT_ENOUGH_BUFFER;
uint8_t* curPos = buff;
if (m_channels == 0)
// if (m_channels == 0)
{
WAVEFORMATPCMEX* waveFormatPCMEx;
uint64_t fmtSize;
Expand Down Expand Up @@ -496,6 +496,17 @@ int LPCMStreamReader::decodeWaveHeader(uint8_t* buff, uint8_t* end)
curPos += fmtSize;
}

// in case there is a 'FLLR' (IPhone filler), skip it
if (curPos[0] == 'F' && curPos[1] == 'L' && curPos[2] == 'L' && curPos[3] == 'R')
{
curPos += 4;
int64_t fllrSize = *reinterpret_cast<int64_t*>(curPos);
curPos += 4;
if (end - curPos < fllrSize)
return NOT_ENOUGH_BUFFER;
curPos += fllrSize;
}

curPos = findSubstr("data", curPos, FFMIN(curPos + MAX_HEADER_SIZE, end));
if (curPos == nullptr)
{
Expand Down

0 comments on commit c37b76e

Please sign in to comment.