Skip to content

Commit

Permalink
No discontinuity for first TS packet of PID
Browse files Browse the repository at this point in the history
Improved version of commit cf8015e
The previous version did remove all false positives but it
suppressed 1/16th of the first real discontinuities.

Signed-off-by: Klaas de Waal <kdewaal@mythtv.org>
  • Loading branch information
David Engel authored and kmdewaal committed Aug 29, 2020
1 parent a0ba072 commit 035a528
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions mythtv/libs/libmythtv/recorders/dtvrecorder.cpp
Expand Up @@ -59,6 +59,8 @@ DTVRecorder::DTVRecorder(TVRec *rec) :
gCoreContext->GetNumSetting("MinimumRecordingQuality", 95);

m_containerFormat = formatMPEG2_TS;

m_continuityCounter.fill(0xff);
}

DTVRecorder::~DTVRecorder(void)
Expand Down Expand Up @@ -1477,7 +1479,7 @@ bool DTVRecorder::ProcessTSPacket(const TSPacket &tspacket)
uint old_cnt = m_continuityCounter[pid];
if ((pid != 0x1fff) && !CheckCC(pid, tspacket.ContinuityCounter()))
{
if (m_pidErrorCount[pid]++ > 0)
if (old_cnt != 0xff)
{
int v = m_continuityErrorCount.fetchAndAddRelaxed(1) + 1;
double erate = v * 100.0 / m_packetCount.fetchAndAddRelaxed(0);
Expand Down Expand Up @@ -1608,7 +1610,7 @@ bool DTVRecorder::ProcessAVTSPacket(const TSPacket &tspacket)
uint old_cnt = m_continuityCounter[pid];
if ((pid != 0x1fff) && !CheckCC(pid, tspacket.ContinuityCounter()))
{
if (m_pidErrorCount[pid]++ > 0)
if (old_cnt != 0xff)
{
int v = m_continuityErrorCount.fetchAndAddRelaxed(1) + 1;
double erate = v * 100.0 / m_packetCount.fetchAndAddRelaxed(0);
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythtv/recorders/dtvrecorder.h
Expand Up @@ -9,7 +9,6 @@
#ifndef DTVRECORDER_H
#define DTVRECORDER_H

#include <map>
#include <vector>

using namespace std;
Expand Down Expand Up @@ -196,7 +195,6 @@ class DTVRecorder :
unsigned long long m_framesSeenCount {0};
unsigned long long m_framesWrittenCount {0};
double m_totalDuration {0.0}; // usec
std::map<uint,uint> m_pidErrorCount;
// Calculate m_total_duration as
// m_td_base + (m_td_tick_count * m_td_tick_framerate / 2)
double m_tdBase {0.0};
Expand Down

0 comments on commit 035a528

Please sign in to comment.