Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

John Smith and committed by
Mauro Carvalho Chehab
5144f5b7 fa7b9ac2

+13 -11
+13 -11
drivers/media/dvb-core/dvb_demux.c
··· 440 440 if (!dvb_demux_feed_err_pkts) 441 441 return; 442 442 } else /* if TEI bit is set, pid may be wrong- skip pkt counter */ 443 - if (demux->cnt_storage && dvb_demux_tscheck) { 444 - /* check pkt counter */ 445 - if (pid < MAX_PID) { 446 - if ((buf[3] & 0xf) != demux->cnt_storage[pid]) 447 - dprintk_tscheck("TS packet counter mismatch. " 448 - "PID=0x%x expected 0x%x " 449 - "got 0x%x\n", 443 + if (demux->cnt_storage && dvb_demux_tscheck) { 444 + /* check pkt counter */ 445 + if (pid < MAX_PID) { 446 + if (buf[3] & 0x10) 447 + demux->cnt_storage[pid] = 448 + (demux->cnt_storage[pid] + 1) & 0xf; 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 452 pid, demux->cnt_storage[pid], 451 453 buf[3] & 0xf); 452 - 453 - demux->cnt_storage[pid] = ((buf[3] & 0xf) + 1)&0xf; 454 + demux->cnt_storage[pid] = buf[3] & 0xf; 455 + } 456 + } 457 + /* end check */ 454 458 } 455 - /* end check */ 456 - } 457 459 458 460 list_for_each_entry(feed, &demux->feed_list, list_head) { 459 461 if ((feed->pid != pid) && (feed->pid != 0x2000))