Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVR: Add data errors field
  • Loading branch information
perexg committed Jan 30, 2015
1 parent adcd748 commit 30d6fa5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/dvr/dvr.h
Expand Up @@ -194,6 +194,11 @@ typedef struct dvr_entry {
*/
uint32_t de_errors;

/**
* Number of data errors (only to be modified by the recording thread)
*/
uint32_t de_data_errors;

/**
* Last error, see SM_CODE_ defines
*/
Expand Down
7 changes: 7 additions & 0 deletions src/dvr/dvr_db.c
Expand Up @@ -1887,6 +1887,13 @@ const idclass_t dvr_entry_class = {
.off = offsetof(dvr_entry_t, de_errors),
.opts = PO_RDONLY,
},
{
.type = PT_U32,
.id = "data_errors",
.name = "Data Errors",
.off = offsetof(dvr_entry_t, de_data_errors),
.opts = PO_RDONLY,
},
{
.type = PT_U16,
.id = "dvb_eid",
Expand Down
12 changes: 9 additions & 3 deletions src/dvr/dvr_rec.c
Expand Up @@ -483,6 +483,7 @@ dvr_thread(void *aux)
profile_chain_t *prch = de->de_chain;
streaming_queue_t *sq = &prch->prch_sq;
streaming_message_t *sm;
th_subscription_t *ts;
th_pkt_t *pkt;
int run = 1;
int started = 0;
Expand All @@ -498,14 +499,19 @@ dvr_thread(void *aux)
continue;
}

if (de->de_s && started) {
if ((ts = de->de_s) != NULL && started) {
pktbuf_t *pb = NULL;
if (sm->sm_type == SMT_PACKET)
pb = ((th_pkt_t*)sm->sm_data)->pkt_payload;
else if (sm->sm_type == SMT_MPEGTS)
pb = sm->sm_data;
if (pb)
atomic_add(&de->de_s->ths_bytes_out, pktbuf_len(pb));
if (pb) {
atomic_add(&ts->ths_bytes_out, pktbuf_len(pb));
if (ts->ths_total_err != de->de_data_errors) {
de->de_data_errors = ts->ths_total_err;
idnode_notify_simple(&de->de_id);
}
}
}

TAILQ_REMOVE(&sq->sq_queue, sm, sm_link);
Expand Down
6 changes: 3 additions & 3 deletions src/webui/static/app/dvr.js
Expand Up @@ -216,7 +216,7 @@ tvheadend.dvr_upcoming = function(panel, index) {
del: true,
list: 'disp_title,episode,pri,start_real,stop_real,' +
'duration,channel,owner,creator,config_name,' +
'sched_status,comment',
'sched_status,errors,data_errors,comment',
sort: {
field: 'start_real',
direction: 'ASC'
Expand Down Expand Up @@ -279,7 +279,7 @@ tvheadend.dvr_finished = function(panel, index) {
'The associated file will be removed from the storage.',
list: 'disp_title,episode,start_real,stop_real,' +
'duration,filesize,channelname,owner,creator,' +
'sched_status,url,comment',
'sched_status,errors,data_errors,url,comment',
columns: {
filesize: {
renderer: tvheadend.filesizeRenderer()
Expand Down Expand Up @@ -359,7 +359,7 @@ tvheadend.dvr_failed = function(panel, index) {
'The associated file will be removed from the storage.',
list: 'disp_title,episode,start_real,stop_real,' +
'duration,filesize,channelname,owner,creator,' +
'status,sched_status,url,comment',
'status,sched_status,errors,data_errors,url,comment',
columns: {
filesize: {
renderer: tvheadend.filesizeRenderer()
Expand Down

0 comments on commit 30d6fa5

Please sign in to comment.