movenc: Ensure no separate moof written for empty track

track->mdat_buf can be not NULL while the track is still empty if the
last packet write failed.

Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Hu Weiwen 2021-08-12 12:43:54 +08:00 committed by Martin Storsjö
parent dbe40478e2
commit 2b77a2f723

View File

@ -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;