Message ID | 20181223152914.14638-1-onemda@gmail.com |
---|---|
State | Accepted |
Commit | 8a8cce078c18050f0905a85997d80bb5c929fa00 |
Headers | show |
On Sun, Dec 23, 2018 at 16:29:14 +0100, Paul B Mahol wrote: > av_assert0(id >= 23 && id < 23 + 4); > + ba = bpcss[id - 23]; > bps = bpcss[id - 23]; [...] > - st->codecpar->block_align = FFMAX(bps * st->codecpar->channels / 8, 1); > + st->codecpar->block_align = ba ? ba : FFMAX(bps * st->codecpar->channels / 8, 1); Since bps never gets reassigned, ba will be equal to bps in the final quoted line. Why not just use one variable? Moritz
On 12/23/18, Moritz Barsnick <barsnick@gmx.net> wrote: > On Sun, Dec 23, 2018 at 16:29:14 +0100, Paul B Mahol wrote: >> av_assert0(id >= 23 && id < 23 + 4); >> + ba = bpcss[id - 23]; >> bps = bpcss[id - 23]; > [...] >> - st->codecpar->block_align = FFMAX(bps * st->codecpar->channels / 8, >> 1); >> + st->codecpar->block_align = ba ? ba : FFMAX(bps * >> st->codecpar->channels / 8, 1); > > Since bps never gets reassigned, ba will be equal to bps in the final > quoted line. Why not just use one variable? I can not use one variable only.
diff --git a/libavformat/au.c b/libavformat/au.c index 520824fc12..0b2b7eac15 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -140,7 +140,7 @@ static int au_read_header(AVFormatContext *s) unsigned int tag; AVIOContext *pb = s->pb; unsigned int id, channels, rate; - int bps; + int bps, ba = 0; enum AVCodecID codec; AVStream *st; @@ -178,6 +178,7 @@ static int au_read_header(AVFormatContext *s) } else { const uint8_t bpcss[] = {4, 0, 3, 5}; av_assert0(id >= 23 && id < 23 + 4); + ba = bpcss[id - 23]; bps = bpcss[id - 23]; } } else if (!bps) { @@ -205,7 +206,7 @@ static int au_read_header(AVFormatContext *s) st->codecpar->sample_rate = rate; st->codecpar->bits_per_coded_sample = bps; st->codecpar->bit_rate = channels * rate * bps; - st->codecpar->block_align = FFMAX(bps * st->codecpar->channels / 8, 1); + st->codecpar->block_align = ba ? ba : FFMAX(bps * st->codecpar->channels / 8, 1); if (data_size != AU_UNKNOWN_SIZE) st->duration = (((int64_t)data_size)<<3) / (st->codecpar->channels * (int64_t)bps);
Fixes #5481. Signed-off-by: Paul B Mahol <onemda@gmail.com> --- libavformat/au.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)