diff options
author | John Smith <johns90812@gmail.com> | 2013-03-05 16:02:43 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-19 14:14:06 -0400 |
commit | 5144f5b76028dbfdbbf2f10721b73a553451c83a (patch) | |
tree | 8f96ec673d290c00944cf7921d182e4bd442df9b | |
parent | fa7b9ac2e25e149fa9972fced79196c0c971a218 (diff) |
[media] dvb_demux: Transport stream continuity check fix
This patch avoids incrementing continuity counter
demux->cnt_storage[pid] for TS packets without payload in accordance
with ISO /IEC 13818-1.
[mchehab@redhat.com: unmangle whitespacing and fix CodingStyle.
Also checked ISO/IEC spec: patch is according with it]
Reviewed-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: John Smith <johns90812@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb-core/dvb_demux.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/media/dvb-core/dvb_demux.c b/drivers/media/dvb-core/dvb_demux.c index d319717eb535..71641b2dde6b 100644 --- a/drivers/media/dvb-core/dvb_demux.c +++ b/drivers/media/dvb-core/dvb_demux.c | |||
@@ -440,20 +440,22 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) | |||
440 | if (!dvb_demux_feed_err_pkts) | 440 | if (!dvb_demux_feed_err_pkts) |
441 | return; | 441 | return; |
442 | } else /* if TEI bit is set, pid may be wrong- skip pkt counter */ | 442 | } else /* if TEI bit is set, pid may be wrong- skip pkt counter */ |
443 | if (demux->cnt_storage && dvb_demux_tscheck) { | 443 | if (demux->cnt_storage && dvb_demux_tscheck) { |
444 | /* check pkt counter */ | 444 | /* check pkt counter */ |
445 | if (pid < MAX_PID) { | 445 | if (pid < MAX_PID) { |
446 | if ((buf[3] & 0xf) != demux->cnt_storage[pid]) | 446 | if (buf[3] & 0x10) |
447 | dprintk_tscheck("TS packet counter mismatch. " | 447 | demux->cnt_storage[pid] = |
448 | "PID=0x%x expected 0x%x " | 448 | (demux->cnt_storage[pid] + 1) & 0xf; |
449 | "got 0x%x\n", | 449 | |
450 | if ((buf[3] & 0xf) != demux->cnt_storage[pid]) { | ||
451 | dprintk_tscheck("TS packet counter mismatch. PID=0x%x expected 0x%x got 0x%x\n", | ||
450 | pid, demux->cnt_storage[pid], | 452 | pid, demux->cnt_storage[pid], |
451 | buf[3] & 0xf); | 453 | buf[3] & 0xf); |
452 | 454 | demux->cnt_storage[pid] = buf[3] & 0xf; | |
453 | demux->cnt_storage[pid] = ((buf[3] & 0xf) + 1)&0xf; | 455 | } |
456 | } | ||
457 | /* end check */ | ||
454 | } | 458 | } |
455 | /* end check */ | ||
456 | } | ||
457 | 459 | ||
458 | list_for_each_entry(feed, &demux->feed_list, list_head) { | 460 | list_for_each_entry(feed, &demux->feed_list, list_head) { |
459 | if ((feed->pid != pid) && (feed->pid != 0x2000)) | 461 | if ((feed->pid != pid) && (feed->pid != 0x2000)) |