[vlc-commits] packetizer: h264: reset timestamps on each AU and always set when missing

Francois Cartegnie git at videolan.org
Thu Nov 9 11:11:29 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Nov  8 18:08:45 2017 +0100| [289607e7ef14c37f07cecd3f2cbfc4763f44e7e7] | committer: Francois Cartegnie

packetizer: h264: reset timestamps on each AU and always set when missing

avoids breaking on rtsp streams where the AU header carries the
timestamps and slice have none.

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

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

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index a7300e2492..ecb233dda9 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -556,7 +556,6 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t *p_pic = NULL;
-    bool b_new_picture = false;
 
     const int i_nal_type = p_frag->p_buffer[4]&0x1f;
     const mtime_t i_frag_dts = p_frag->i_dts;
@@ -567,12 +566,8 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
         msg_Warn( p_dec, "waiting for SPS/PPS" );
 
         /* Reset context */
-        p_sys->slice.type = H264_SLICE_TYPE_UNKNOWN;
-        p_sys->b_slice = false;
         DropStoredNAL( p_sys );
-        /* From SEI */
-        p_sys->i_dpb_output_delay = 0;
-        p_sys->i_pic_struct = UINT8_MAX;
+        ResetOutputVariables( p_sys );
         cc_storage_reset( p_sys->p_ccs );
     }
 
@@ -600,7 +595,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
                 if( newslice.i_idr_pic_id == -1 )
                     newslice.i_idr_pic_id = p_sys->slice.i_idr_pic_id;
 
-                b_new_picture = IsFirstVCLNALUnit( &p_sys->slice, &newslice );
+                bool b_new_picture = IsFirstVCLNALUnit( &p_sys->slice, &newslice );
                 if( b_new_picture )
                 {
                     /* Parse SEI for that frame now we should have matched SPS/PPS */
@@ -708,7 +703,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
 
     *pb_ts_used = false;
     if( p_sys->i_frame_dts <= VLC_TS_INVALID &&
-        p_sys->i_frame_pts <= VLC_TS_INVALID && b_new_picture )
+        p_sys->i_frame_pts <= VLC_TS_INVALID )
     {
         p_sys->i_frame_dts = i_frag_dts;
         p_sys->i_frame_pts = i_frag_pts;



More information about the vlc-commits mailing list