Skip to content

Commit

Permalink
No discontinuity for first TS packet of PID
Browse files Browse the repository at this point in the history
This reverses commit cf8015e
and 035a528 except the part
where all elements of m_continuityCounter are initialized to 0xff.

On Nov 10, 2019, in commit da80277 the
initialization to 0xff has been replaced with initialization to 0
and this is what caused the erroneous discontinuity reporting.
Initialization to 0xff is now restored.
  • Loading branch information
kmdewaal committed Aug 29, 2020
1 parent 035a528 commit d0c9ebc
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions mythtv/libs/libmythtv/recorders/dtvrecorder.cpp
Expand Up @@ -1479,16 +1479,13 @@ bool DTVRecorder::ProcessTSPacket(const TSPacket &tspacket)
uint old_cnt = m_continuityCounter[pid];
if ((pid != 0x1fff) && !CheckCC(pid, tspacket.ContinuityCounter()))
{
if (old_cnt != 0xff)
{
int v = m_continuityErrorCount.fetchAndAddRelaxed(1) + 1;
double erate = v * 100.0 / m_packetCount.fetchAndAddRelaxed(0);
LOG(VB_RECORD, LOG_WARNING, LOC +
QString("PID 0x%1 discontinuity detected ((%2+1)%16!=%3) %4%")
.arg(pid,0,16).arg(old_cnt,2)
.arg(tspacket.ContinuityCounter(),2)
.arg(erate));
}
int v = m_continuityErrorCount.fetchAndAddRelaxed(1) + 1;
double erate = v * 100.0 / m_packetCount.fetchAndAddRelaxed(0);
LOG(VB_RECORD, LOG_WARNING, LOC +
QString("PID 0x%1 discontinuity detected ((%2+1)%16!=%3) %4%")
.arg(pid,0,16).arg(old_cnt,2)
.arg(tspacket.ContinuityCounter(),2)
.arg(erate));
}

// Only create fake keyframe[s] if there are no audio/video streams
Expand Down Expand Up @@ -1610,15 +1607,12 @@ bool DTVRecorder::ProcessAVTSPacket(const TSPacket &tspacket)
uint old_cnt = m_continuityCounter[pid];
if ((pid != 0x1fff) && !CheckCC(pid, tspacket.ContinuityCounter()))
{
if (old_cnt != 0xff)
{
int v = m_continuityErrorCount.fetchAndAddRelaxed(1) + 1;
double erate = v * 100.0 / m_packetCount.fetchAndAddRelaxed(0);
LOG(VB_RECORD, LOG_WARNING, LOC +
QString("A/V PID 0x%1 discontinuity detected ((%2+1)%16!=%3) %4%")
.arg(pid,0,16).arg(old_cnt).arg(tspacket.ContinuityCounter())
.arg(erate,5,'f',2));
}
int v = m_continuityErrorCount.fetchAndAddRelaxed(1) + 1;
double erate = v * 100.0 / m_packetCount.fetchAndAddRelaxed(0);
LOG(VB_RECORD, LOG_WARNING, LOC +
QString("A/V PID 0x%1 discontinuity detected ((%2+1)%16!=%3) %4%")
.arg(pid,0,16).arg(old_cnt).arg(tspacket.ContinuityCounter())
.arg(erate,5,'f',2));
}

if (!(m_pidStatus[pid] & kPayloadStartSeen))
Expand Down

0 comments on commit d0c9ebc

Please sign in to comment.