[vlc-commits] demux: ts: avoid flapping scrambled state

Francois Cartegnie git at videolan.org
Thu Aug 6 19:11:36 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Aug  6 19:08:07 2015 +0200| [3231fffeab8492295f5cc63985691f91c607b4c0] | committer: Francois Cartegnie

demux: ts: avoid flapping scrambled state

Some streams send clear padded data (probably
due to insufficient remaining data for encryption)

We'll only test on payload start then.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3231fffeab8492295f5cc63985691f91c607b4c0
---

 modules/demux/mpeg/ts.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 2f65c1c..9f3af4a 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1256,8 +1256,11 @@ static int Demux( demux_t *p_demux )
         /* Parse the TS packet */
         ts_pid_t *p_pid = GetPID( p_sys, PIDGet( p_pkt ) );
 
-        if( SCRAMBLED(*p_pid) != !!(p_pkt->p_buffer[3] & 0x80) )
+        if( (p_pkt->p_buffer[1] & 0x40) && (p_pkt->p_buffer[3] & 0x10) &&
+            !SCRAMBLED(*p_pid) != !(p_pkt->p_buffer[3] & 0x80) )
+        {
             UpdateScrambledState( p_demux, p_pid, p_pkt->p_buffer[3] & 0x80 );
+        }
 
         if( !SEEN(p_pid) )
         {



More information about the vlc-commits mailing list