avformat/utils: Do not compute the bitrate from duration == 0

Fixes division by 0 in fate-acodec-ra144

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2016-05-16 13:43:02 +02:00
parent 6085d6b2ae
commit 635b2ec5f2
1 changed files with 1 additions and 1 deletions

View File

@ -2529,7 +2529,7 @@ static void update_stream_timings(AVFormatContext *ic)
if (duration != INT64_MIN && duration > 0 && ic->duration == AV_NOPTS_VALUE) {
ic->duration = duration;
}
if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration != AV_NOPTS_VALUE) {
if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0) {
/* compute the bitrate */
double bitrate = (double) filesize * 8.0 * AV_TIME_BASE /
(double) ic->duration;