Skip to content

Commit

Permalink
Improve checking for continuity errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Catalin Toda committed Aug 16, 2020
1 parent e8bb03b commit 747c3c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ int update_pids(int aid)
ad->pat_processed = 0;
ad->pids[i].packets = 0;
ad->pids[i].cc = -1;
ad->pids[i].cc1 = -1;
ad->pids[i].cc_err = 0;
ad->pids[i].dec_err = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/socketworks.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ int sockets_read(int socket, void *buf, int len, sockets *ss, int *rv)
{
*rv = read(socket, buf, len);
if (*rv > 0 && ss->type == TYPE_DVR && (opts.debug & LOG_DMX))
dump_packets("read ->", buf, *rv, ss->rlen);
_dump_packets("read ->", buf, *rv, ss->rlen);

return (*rv > 0);
}
Expand Down
13 changes: 7 additions & 6 deletions src/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,15 @@ int check_cc(adapter *ad)
pid = PID_FROM_TS(b);
if (pid == 8191)
continue;

if ((opts.debug & LOG_DMX) == LOG_DMX)
_dump_packets("check_cc -> ", b, 188, i);

p = find_pid(ad->id, pid);

if ((!p))
{
LOGM("%s: pid %d not found", __FUNCTION__, pid);
LOGM("%s: pid %03d not found", __FUNCTION__, pid);
ad->pid_err++;
packet_no_sid++;
continue;
Expand All @@ -823,14 +827,11 @@ int check_cc(adapter *ad)
else
p->cc = (p->cc + 1) % 16;

if ((opts.debug & LOG_DMX) == LOG_DMX)
dump_packets("check_cc -> ", b, 188, i);

// if(b[1] ==0x40 && b[2]==0) LOG("PAT TID = %d", b[8] * 256 + b[9]);
if (p->cc != cc)
{
LOG("PID Continuity error (adapter %d): pid: %03d, Expected CC: %X, Actual CC: %X, CC Before %X",
ad->id, pid, p->cc, cc, cc_before);
LOG("PID Continuity error (adapter %d, pos %d): pid: %03d, Expected CC: %X, Actual CC: %X, CC Before %X",
ad->id, i / DVB_FRAME, pid, p->cc, cc, cc_before);
p->cc_err++;
}
p->cc = cc;
Expand Down

0 comments on commit 747c3c4

Please sign in to comment.