From 2b77a2f723cd0af441db26dd5ee632af3040e7cb Mon Sep 17 00:00:00 2001 From: Hu Weiwen Date: Thu, 12 Aug 2021 12:43:54 +0800 Subject: [PATCH] movenc: Ensure no separate moof written for empty track MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit track->mdat_buf can be not NULL while the track is still empty if the last packet write failed. Signed-off-by: Hu Weiwen Signed-off-by: Martin Storsjö --- libavformat/movenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index bcc202300b..a460cd9ada 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5422,7 +5422,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force) duration = track->start_dts + track->track_duration - track->cluster[0].dts; if (mov->flags & FF_MOV_FLAG_SEPARATE_MOOF) { - if (!track->mdat_buf) + if (!track->entry) continue; mdat_size = avio_tell(track->mdat_buf); moof_tracks = i;