]> git.sesse.net Git - x264/commitdiff
Fix crash with MP4-muxing if zero frames were encoded
authorAnton Mitrofanov <BugMaster@narod.ru>
Mon, 31 May 2010 18:36:50 +0000 (22:36 +0400)
committerFiona Glaser <fiona@x264.com>
Mon, 31 May 2010 18:43:00 +0000 (11:43 -0700)
output/mp4.c

index f76541ed91ffc35d804b064fe5f5e60591626a12..0aa50707943e0c66353c75180a7e6a2d7c51241a 100644 (file)
@@ -112,6 +112,7 @@ static int close_file( hnd_t handle, int64_t largest_pts, int64_t second_largest
         if( p_mp4->p_sample->data )
             free( p_mp4->p_sample->data );
 
+        p_mp4->p_sample->dataLength = 0;
         gf_isom_sample_del( &p_mp4->p_sample );
     }
 
@@ -135,7 +136,7 @@ static int close_file( hnd_t handle, int64_t largest_pts, int64_t second_largest
          * The reason is that an Edit Box maps the presentation time-line to the media time-line.
          * Any demuxers should follow the Edit Box if it exists. */
         GF_ISOSample *sample = gf_isom_get_sample_info( p_mp4->p_file, p_mp4->i_track, 1, NULL, NULL );
-        if( sample->CTS_Offset > 0 )
+        if( sample && sample->CTS_Offset > 0 )
         {
             uint32_t mvhd_timescale = gf_isom_get_timescale( p_mp4->p_file );
             uint64_t tkhd_duration = (uint64_t)( mdhd_duration * ( (double)mvhd_timescale / p_mp4->i_time_res ) );