Skip to content

Commit

Permalink
AEStreamInfo: Support EAC3 independent + EAC3 (dependent) streams
Browse files Browse the repository at this point in the history
Fixes: xbmc#19182
  • Loading branch information
popcornmix committed Apr 25, 2023
1 parent 668979f commit d865c1b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,25 @@ bool CAEStreamParser::TrySyncAC3(uint8_t *data, unsigned int size, bool resyncin
m_fsize = framesize << 1;
m_info.m_repeat = MAX_EAC3_BLOCKS / blocks;

/* EAC3 can have a dependent stream too */
if (!wantEAC3dependent)
{
unsigned int fsizeMain = m_fsize;
unsigned int reqBytes = fsizeMain + 8;
if (size < reqBytes) {
/* not enough data to check for E-AC3 dependent frame, request more */
m_needBytes = reqBytes;
m_fsize = 0;
/* no need to resync => return true */
return true;
}
if (TrySyncAC3(data + fsizeMain, size - fsizeMain, resyncing, /*wantEAC3dependent*/ true)) {
/* concatenate the main and dependent frames */
m_fsize += fsizeMain;
return true;
}
}

if (m_info.m_type == CAEStreamInfo::STREAM_TYPE_EAC3 && m_hasSync && !resyncing)
return true;

Expand Down

0 comments on commit d865c1b

Please sign in to comment.