Skip to content

Commit

Permalink
[bug] Fix increment of EAC3 frames
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdr428 committed Jan 1, 2023
1 parent f3f95c5 commit 223a02f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 12 additions & 7 deletions tsMuxer/ac3Codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ AC3Codec::AC3ParseError AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
if (id > 16)
return AC3ParseError::BSID;

m_previousid = m_bsid;
m_bsid = id;
if (m_bsid > 10) // bsid = 16 => EAC3
{
Expand Down Expand Up @@ -305,7 +304,7 @@ int AC3Codec::decodeFrame(uint8_t* buf, uint8_t* end, int& skipBytes)
}
}

if ((m_true_hd_mode)) // ommit AC3+
if ((m_true_hd_mode)) // omit AC3+
{
uint8_t* trueHDData = buf + rez;
if (end - trueHDData < 7)
Expand Down Expand Up @@ -443,13 +442,19 @@ bool AC3Codec::testDecodeTestFrame(uint8_t* buf, uint8_t* end)

uint64_t AC3Codec::getFrameDurationNano()
{
if (m_previousid > 10 && m_bsid <= 10)
return 0; // E-AC3. finish frame after AC3 frame
if (m_previousid > 10 && m_bsid > 10 && m_strmtyp == 1)
return 0; // E-AC3 dependeant substream
// Pure EAC3: wait for dependent substream
if (!m_bit_rate && m_strmtyp == 1)
return 0;

// Interleaved AC3/EAC3: wait for EAC3 frame
if (m_bit_rateExt && m_bsid <= 10)
return 0;

// Interleaved AC3/TrueHD: wait for end of True HD frame
if (m_waitMoreData)
return 0; // AC3 HD
return 0;

// OK to increment PTS
return m_frameDurationNano;
}

Expand Down
2 changes: 0 additions & 2 deletions tsMuxer/ac3Codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class AC3Codec
m_lfeon = 0;
m_extChannelsExists = false;
m_bsid = m_bsidBase = 0;
m_previousid = 0;
m_strmtyp = 0;
m_dsurmod = 0;
m_mixinfoexists = false;
Expand Down Expand Up @@ -79,7 +78,6 @@ class AC3Codec
int m_frmsizecod;
uint8_t m_bsid;
uint8_t m_bsidBase;
uint8_t m_previousid;
uint8_t m_strmtyp;
uint8_t m_bsmod;
uint8_t m_acmod;
Expand Down

0 comments on commit 223a02f

Please sign in to comment.