remove b_header in packetizer so sps/pps are send with every keyframe,
authorIlkka Ollakka <ileoo@videolan.org>
Fri, 4 Jan 2008 20:05:15 +0000 (20:05 +0000)
committerIlkka Ollakka <ileoo@videolan.org>
Fri, 4 Jan 2008 20:05:15 +0000 (20:05 +0000)
shouldn't break anything (tested on mp4/ts files, rtp stream and http/ts
stream). Files play correctly and MP4Box/ffmpeg recognize them
correctly. should fix #1384

modules/packetizer/h264.c

index 23e1720..132e3c3 100644 (file)
@@ -91,7 +91,6 @@ struct decoder_sys_t
 
     vlc_bool_t   b_sps;
     vlc_bool_t   b_pps;
-    vlc_bool_t   b_header;
 
     /* avcC data */
     int i_avcC_length_size;
@@ -185,7 +184,6 @@ static int Open( vlc_object_t *p_this )
     p_sys->b_pps   = VLC_FALSE;
     p_sys->p_sps   = 0;
     p_sys->p_pps   = 0;
-    p_sys->b_header= VLC_FALSE;
 
     p_sys->slice.i_nal_type = -1;
     p_sys->slice.i_nal_ref_idc = -1;
@@ -251,7 +249,6 @@ static int Open( vlc_object_t *p_this )
         p_dec->fmt_out.p_extra = (uint8_t*)malloc( p_dec->fmt_out.i_extra );
         memcpy( (uint8_t*)p_dec->fmt_out.p_extra, p_sys->p_sps->p_buffer, p_sys->p_sps->i_buffer);
         memcpy( (uint8_t*)p_dec->fmt_out.p_extra+p_sys->p_sps->i_buffer, p_sys->p_pps->p_buffer, p_sys->p_pps->i_buffer);
-        p_sys->b_header = VLC_TRUE;
 
         /* Set callback */
         p_dec->pf_packetize = PacketizeAVC1;
@@ -535,10 +532,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
 
 #define OUTPUT \
     do {                                                      \
-        if( !p_sys->b_header && p_sys->slice.i_frame_type != BLOCK_FLAG_TYPE_I) \
-            break;                                            \
-                                                              \
-        if( p_sys->slice.i_frame_type == BLOCK_FLAG_TYPE_I && p_sys->p_sps && p_sys->p_pps && !p_sys->b_header ) \
+        if( p_sys->slice.i_frame_type == BLOCK_FLAG_TYPE_I && p_sys->p_sps && p_sys->p_pps ) \
         { \
             block_t *p_sps = block_Duplicate( p_sys->p_sps ); \
             block_t *p_pps = block_Duplicate( p_sys->p_pps ); \
@@ -546,7 +540,6 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
             p_sps->i_pts = p_sys->p_frame->i_pts;           \
             block_ChainAppend( &p_sps, p_pps );               \
             block_ChainAppend( &p_sps, p_sys->p_frame );      \
-            p_sys->b_header = VLC_TRUE;                       \
             p_pic = block_ChainGather( p_sps );               \
         } else { \
             p_pic = block_ChainGather( p_sys->p_frame ); \