diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-02-12 12:05:43 +0100 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-02-17 17:04:10 +0100 |
commit | 3ce7148dff61f782336940470a7af5eea59932f4 (patch) | |
tree | ba58e45b2af014e5afc5a0340b14d4666c4326e1 /libavformat/movenc.c | |
parent | 857d14863d323c484e00fd4a553b3e28af35400f (diff) | |
download | ffmpeg-3ce7148dff61f782336940470a7af5eea59932f4.tar.gz |
movenc: fix crashes if a stream is empty.
For some reason this always happens with -f ismv.
See trac issue #996.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 1f56fe14fb..d1337a0705 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -287,6 +287,8 @@ static unsigned compute_avg_bitrate(MOVTrack *track) { uint64_t size = 0; int i; + if (!track->track_duration) + return 0; for (i = 0; i < track->entry; i++) size += track->cluster[i].size; return size * 8 * track->timescale / track->track_duration; @@ -2052,7 +2054,8 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, mov->tracks[i].time = mov->time; mov->tracks[i].track_id = i+1; - build_chunks(&mov->tracks[i]); + if (mov->tracks[i].entry) + build_chunks(&mov->tracks[i]); } if (mov->chapter_track) |