omadec: fix overflows during bit rate calculation

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun 2016-12-13 00:35:12 +01:00
parent 09905c412d
commit d74c471a39
1 changed files with 2 additions and 2 deletions

View File

@ -365,7 +365,7 @@ static int oma_read_header(AVFormatContext *s)
st->codecpar->channels = 2; st->codecpar->channels = 2;
st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
st->codecpar->sample_rate = samplerate; st->codecpar->sample_rate = samplerate;
st->codecpar->bit_rate = st->codecpar->sample_rate * framesize * 8 / 1024; st->codecpar->bit_rate = st->codecpar->sample_rate * framesize / (1024 / 8);
/* fake the ATRAC3 extradata /* fake the ATRAC3 extradata
* (wav format, makes stream copy to wav work) */ * (wav format, makes stream copy to wav work) */
@ -398,7 +398,7 @@ static int oma_read_header(AVFormatContext *s)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
st->codecpar->sample_rate = samplerate; st->codecpar->sample_rate = samplerate;
st->codecpar->bit_rate = samplerate * framesize * 8 / 2048; st->codecpar->bit_rate = samplerate * framesize / (2048 / 8);
avpriv_set_pts_info(st, 64, 1, samplerate); avpriv_set_pts_info(st, 64, 1, samplerate);
break; break;
case OMA_CODECID_MP3: case OMA_CODECID_MP3: