[vlc-commits] demux: ts: early reject corrupted packets
Francois Cartegnie
git at videolan.org
Thu Dec 22 13:51:45 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 22 13:36:45 2016 +0100| [71089d390f1a2bbcfe1645fcedd54e06e30b4b61] | committer: Francois Cartegnie
demux: ts: early reject corrupted packets
There's no way to know if any of the bits is valid.
We can't even flag pid with corrupted/discontinuity
as its number can also be corrupted.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=71089d390f1a2bbcfe1645fcedd54e06e30b4b61
---
modules/demux/mpeg/ts.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index a7091e2..4bcc00c 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -623,6 +623,15 @@ static int Demux( demux_t *p_demux )
continue;
}
+ /* Reject any fully uncorrected packet. Even PID can be incorrect */
+ if( p_pkt->p_buffer[1]&0x80 )
+ {
+ msg_Dbg( p_demux, "transport_error_indicator set (pid=%d)",
+ PIDGet( p_pkt ) );
+ block_Release( p_pkt );
+ continue;
+ }
+
/* Parse the TS packet */
ts_pid_t *p_pid = GetPID( p_sys, PIDGet( p_pkt ) );
@@ -1940,7 +1949,8 @@ static int ProbeChunk( demux_t *p_demux, int i_program, bool b_end, int64_t *pi_
break;
}
- if( p_pkt->i_size < TS_PACKET_SIZE_188 )
+ if( p_pkt->i_size < TS_PACKET_SIZE_188 &&
+ ( p_pkt->p_buffer[1]&0x80 ) /* transport error */ )
{
block_Release( p_pkt );
continue;
@@ -2351,14 +2361,6 @@ static bool ProcessTSPacket( demux_t *p_demux, ts_pid_t *pid, block_t *p_pkt )
* TODO: handle Reed-Solomon 204,188 error correction */
p_pkt->i_buffer = TS_PACKET_SIZE_188;
- if( p[1]&0x80 )
- {
- msg_Dbg( p_demux, "transport_error_indicator set (pid=%d)",
- pid->i_pid );
- if( p_pes->gather.p_data ) //&& pid->es->fmt.i_cat == VIDEO_ES )
- p_pes->gather.p_data->i_flags |= BLOCK_FLAG_CORRUPTED;
- }
-
if( SCRAMBLED(*pid) )
{
if( p_demux->p_sys->csa )
More information about the vlc-commits
mailing list