mpegts: added some additional mux statistics

This commit is contained in:
Adam Sutton 2014-04-16 20:44:55 +01:00
parent cbbb227aa4
commit 2c8bc0cc47
5 changed files with 23 additions and 0 deletions

View file

@ -84,6 +84,8 @@ tvh_input_stream_create_msg
htsmsg_add_u32(m, "snr", st->stats.snr);
htsmsg_add_u32(m, "unc", st->stats.unc);
htsmsg_add_u32(m, "bps", st->stats.bps);
htsmsg_add_u32(m, "te", st->stats.te);
htsmsg_add_u32(m, "cc", st->stats.cc);
return m;
}

View file

@ -44,6 +44,8 @@ struct tvh_input_stream_stats
int unc; ///< Uncorrectable errors
int snr; ///< Signal 2 Noise (dB)
int bps; ///< Bandwidth (bps)
int cc; ///< Continuity errors
int te; ///< Transport errors
};
struct tvh_input_stream {

View file

@ -120,6 +120,7 @@ typedef struct mpegts_pid
{
int mp_pid;
int mp_fd; // linuxdvb demux fd
int8_t mp_cc;
RB_HEAD(,mpegts_pid_sub) mp_subs; // subscribers to pid
RB_ENTRY(mpegts_pid) mp_link;
} mpegts_pid_t;

View file

@ -516,12 +516,29 @@ mpegts_input_process
mpegts_pid_sub_t *mps;
service_t *s;
int pid = ((tsb[i+1] & 0x1f) << 8) | tsb[i+2];
int cc = (tsb[i+3] & 0x0f);
int pl = (tsb[i+3] & 0x10) ? 1 : 0;
int te = (tsb[i+1] & 0x80);
/* Ignore NUL packets */
if (pid == 0x1FFF) goto done;
/* Transport error */
if (te)
++mmi->mmi_stats.te;
/* Find PID */
if ((mp = mpegts_mux_find_pid(mm, pid, 0))) {
/* Low level CC check */
if (pl) {
if (mp->mp_cc != -1 && mp->mp_cc != cc) {
tvhtrace("mpegts", "pid %04X cc err %2d != %2d", pid, cc, mp->mp_cc);
++mmi->mmi_stats.cc;
}
mp->mp_cc = (cc + 1) & 0xF;
}
// Note: there is a minor danger this caching will get things
// wrong for a brief period of time if the registrations on
// the PID change

View file

@ -919,6 +919,7 @@ mpegts_mux_find_pid_ ( mpegts_mux_t *mm, int pid, int create )
mp = mpegts_pid_skel;
SKEL_USED(mpegts_pid_skel);
mp->mp_fd = -1;
mp->mp_cc = -1;
}
}
if (mp) {