Fix crash if invalid bit-rate was read from file.

Fixes issue 2426.

Patch by David Czech, davidczech510 gmail

Originally committed as revision 26061 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
David Czech 2010-12-20 09:58:27 +00:00 committed by Carl Eugen Hoyos
parent fee0deb61f
commit 9100d4d632

View File

@ -1870,10 +1870,11 @@ static void av_estimate_timings_from_bit_rate(AVFormatContext *ic)
AVStream *st;
/* if bit_rate is already set, we believe it */
if (ic->bit_rate == 0) {
if (ic->bit_rate <= 0) {
bit_rate = 0;
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if (st->codec->bit_rate > 0)
bit_rate += st->codec->bit_rate;
}
ic->bit_rate = bit_rate;