David <[email protected]> added the comment:
This patch checks for frame and size before calling av_rescale.
________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/issue2442>
________________________________________________
Index: libavformat/mp3.c
===================================================================
--- libavformat/mp3.c (revision 26076)
+++ libavformat/mp3.c (working copy)
@@ -128,7 +128,7 @@
if(frames)
st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
st->time_base);
- if(size)
+ if(frames && size)
st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf);
return 0;