[vlc-commits] demux: vobsub: skip unwanted block alloc/memcpy

Francois Cartegnie git at videolan.org
Tue Oct 8 19:15:11 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Oct  8 15:30:46 2019 +0200| [944d498b883ef83d20f859d4f0319927c068f3eb] | committer: Francois Cartegnie

demux: vobsub: skip unwanted block alloc/memcpy

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

 modules/demux/vobsub.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/modules/demux/vobsub.c b/modules/demux/vobsub.c
index e75c3bc183..ba247d9a10 100644
--- a/modules/demux/vobsub.c
+++ b/modules/demux/vobsub.c
@@ -629,7 +629,7 @@ static int DemuxVobSub( demux_t *p_demux, block_t *p_bk )
     {
         int i_size = ps_pkt_size( p, p_end - p );
         block_t *p_pkt;
-        int      i_id;
+        int      i_id = 0;
         int      i_spu;
 
         if( i_size <= 0 )
@@ -647,7 +647,8 @@ static int DemuxVobSub( demux_t *p_demux, block_t *p_bk )
             break;
         }
 
-        if( p[3] != 0xbd )
+        i_id = ps_pkt_id( p, i_size );
+        if( (i_id&0xffe0) != 0xbd20 )
         {
             /* msg_Dbg( p_demux, "we don't need these ps packets (id=0x1%2.2x)", p[3] ); */
             p += i_size;
@@ -661,9 +662,7 @@ static int DemuxVobSub( demux_t *p_demux, block_t *p_bk )
         memcpy( p_pkt->p_buffer, p, i_size);
         p += i_size;
 
-        i_id = ps_pkt_id( p_pkt->p_buffer, p_pkt->i_buffer );
-        if( (i_id&0xffe0) != 0xbd20 ||
-            ps_pkt_parse_pes( VLC_OBJECT(p_demux), p_pkt, 1 ) )
+        if( ps_pkt_parse_pes( VLC_OBJECT(p_demux), p_pkt, 1 ) )
         {
             block_Release( p_pkt );
             continue;



More information about the vlc-commits mailing list