media: dvb: Report error statistics in new PES events

Report counters for transport error indicator, continuity-counter
errors and total number of TS packet constructing a PES in the
PES events so that applications can decide whether to decode
or drop the packet based on the errors information.

Change-Id: I8680163783a12c4f2518cd83fa0b3c7dfa882c34
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
This commit is contained in:
Hamad Kadmany
2013-01-17 17:36:17 +02:00
committed by Iliyan Malchev
parent f6bd2774e4
commit 936e0d378e
5 changed files with 59 additions and 13 deletions

View File

@@ -7,7 +7,7 @@
* Copyright (c) 2000 Nokia Research Center
* Tampere, FINLAND
*
* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -100,6 +100,9 @@ struct dmx_data_ready {
int disc_indicator_set;
int pes_length_mismatch;
u64 stc;
u32 tei_counter;
u32 cont_err_counter;
u32 ts_packets_num;
} pes_end;
struct {

View File

@@ -1861,6 +1861,9 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
event.params.pes.flags = 0;
event.params.pes.stc = 0;
event.params.pes.transport_error_indicator_counter = 0;
event.params.pes.continuity_error_counter = 0;
event.params.pes.ts_packets_num = 0;
dvb_dmxdev_add_event(events, &event);
events->current_event_data_size = 0;
@@ -2109,6 +2112,13 @@ static int dvb_dmxdev_ts_event_cb(struct dmx_ts_feed *feed,
DMX_FILTER_PES_LENGTH_ERROR;
event.params.pes.stc = dmx_data_ready->pes_end.stc;
event.params.pes.transport_error_indicator_counter =
dmx_data_ready->pes_end.tei_counter;
event.params.pes.continuity_error_counter =
dmx_data_ready->pes_end.cont_err_counter;
event.params.pes.ts_packets_num =
dmx_data_ready->pes_end.ts_packets_num;
dvb_dmxdev_add_event(events, &event);
events->current_event_data_size = 0;

View File

@@ -5,7 +5,7 @@
* & Marcus Metzler <marcus@convergence.de>
* for convergence integrated media GmbH
*
* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -127,15 +127,15 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed,
{
int count = payload(buf);
int p;
//int ccok;
//u8 cc;
int ccok;
u8 cc;
struct dmx_data_ready data;
if (count == 0)
return -1;
p = 188 - count;
/*
cc = buf[3] & 0x0f;
if (feed->first_cc)
ccok = 1;
@@ -144,26 +144,41 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed,
feed->first_cc = 0;
feed->cc = cc;
if (!ccok)
printk("missed packet!\n");
*/
/* PUSI ? */
if (buf[1] & 0x40) {
if (feed->pusi_seen)
if (feed->pusi_seen) {
/* We had seen PUSI before, this means
* that previous PES can be closed now.
*/
feed->cb.ts(NULL, 0, NULL, 0,
&feed->feed.ts, DMX_OK_PES_END);
data.status = DMX_OK_PES_END;
data.data_length = 0;
data.pes_end.start_gap = 0;
data.pes_end.actual_length = feed->peslen;
data.pes_end.disc_indicator_set = 0;
data.pes_end.pes_length_mismatch = 0;
data.pes_end.stc = 0;
data.pes_end.tei_counter = feed->pes_tei_counter;
data.pes_end.cont_err_counter =
feed->pes_cont_err_counter;
data.pes_end.ts_packets_num = feed->pes_ts_packets_num;
feed->data_ready_cb.ts(&feed->feed.ts, &data);
}
feed->pusi_seen = 1;
feed->peslen = 0;
feed->pes_tei_counter = 0;
feed->pes_ts_packets_num = 0;
feed->pes_cont_err_counter = 0;
}
if (feed->pusi_seen == 0)
return 0;
feed->pes_ts_packets_num++;
feed->pes_cont_err_counter += !ccok;
feed->pes_tei_counter += (buf[1] & 0x80) ? 1 : 0;
feed->peslen += count;
return feed->cb.ts(&buf[p], count, NULL, 0, &feed->feed.ts, DMX_OK);
@@ -1243,6 +1258,9 @@ static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
feed->demux = demux;
feed->pid = 0xffff;
feed->peslen = 0;
feed->pes_tei_counter = 0;
feed->pes_ts_packets_num = 0;
feed->pes_cont_err_counter = 0;
feed->buffer = NULL;
feed->tsp_out_format = DMX_TSP_FORMAT_188;
memset(&feed->indexing_params, 0,

View File

@@ -4,7 +4,7 @@
* Copyright (C) 2000-2001 Marcus Metzler & Ralph Metzler
* for convergence integrated media GmbH
*
* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -105,6 +105,9 @@ struct dvb_demux_feed {
int pusi_seen; /* prevents feeding of garbage from previous section */
u32 peslen;
u32 pes_tei_counter;
u32 pes_cont_err_counter;
u32 pes_ts_packets_num;
struct list_head list_head;
unsigned int index; /* a unique index for each feed (can be used as hardware pid filter index) */

View File

@@ -5,7 +5,7 @@
* & Ralph Metzler <ralph@convergence.de>
* for convergence integrated media GmbH
*
* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -250,6 +250,18 @@ struct dmx_pes_event_info {
/* Flags passed in filter events */
__u32 flags;
/*
* Number of TS packets with Transport Error Indicator (TEI)
* found while constructing the PES.
*/
__u32 transport_error_indicator_counter;
/* Number of continuity errors found while constructing the PES */
__u32 continuity_error_counter;
/* Total number of TS packets holding the PES */
__u32 ts_packets_num;
};
/* Section info associated with DMX_EVENT_NEW_SECTION event */