[vlc-commits] packetizer: h264: use stripAnnexB in ParseSlice

Francois Cartegnie git at videolan.org
Sun Dec 20 16:45:53 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Dec 19 23:34:23 2015 +0100| [fb4119ba59f9324bfb158c7d1c136bea5187db1a] | committer: Francois Cartegnie

packetizer: h264: use stripAnnexB in ParseSlice

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

 modules/packetizer/h264.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index e603eea..0258aec 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -800,14 +800,18 @@ static bool ParseSlice( decoder_t *p_dec, bool *pb_new_picture, slice_t *p_slice
     int i_slice_type;
     slice_t slice;
     bs_t s;
+    unsigned i_bitflow = 0;
+
+    const uint8_t *p_stripped = p_frag->p_buffer;
+    size_t i_stripped = p_frag->i_buffer;
 
-    if(p_frag->i_buffer < 6)
+    if( !hxxx_strip_AnnexB_startcode( &p_stripped, &i_stripped ) || i_stripped < 2 )
         return false;
 
-    bs_init( &s, &p_frag->p_buffer[5], p_frag->i_buffer - 5 );
-    unsigned i_bitflow = 0;
+    bs_init( &s, p_stripped, i_stripped );
     s.p_fwpriv = &i_bitflow;
     s.pf_forward = hxxx_bsfw_ep3b_to_rbsp;  /* Does the emulated 3bytes conversion to rbsp */
+    bs_skip( &s, 8 ); /* nal unit header */
 
     /* first_mb_in_slice */
     /* int i_first_mb = */ bs_read_ue( &s );



More information about the vlc-commits mailing list