From cb94c2bdc9989d55deb6899ab77b0d40d185ab21 Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Mon, 31 May 2010 22:36:50 +0400 Subject: [PATCH] Fix crash with MP4-muxing if zero frames were encoded --- output/mp4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/output/mp4.c b/output/mp4.c index f76541ed..0aa50707 100644 --- a/output/mp4.c +++ b/output/mp4.c @@ -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 ) ); -- 2.39.2