1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavf/au: check bits per coded sample.

Without that, it would repeatedly produce empty packets
if the codec if forced to something invalid.

Fix trac ticket #1652.
This commit is contained in:
Nicolas George 2012-08-18 14:12:41 +02:00
parent 7f46f042d1
commit 92b8c9d89e

View File

@ -181,10 +181,13 @@ static int au_read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
int ret; int ret;
int bpcs = av_get_bits_per_sample(s->streams[0]->codec->codec_id);
if (!bpcs)
return AVERROR(EINVAL);
ret= av_get_packet(s->pb, pkt, BLOCK_SIZE * ret= av_get_packet(s->pb, pkt, BLOCK_SIZE *
s->streams[0]->codec->channels * s->streams[0]->codec->channels *
av_get_bits_per_sample(s->streams[0]->codec->codec_id) >> 3); bpcs >> 3);
if (ret < 0) if (ret < 0)
return ret; return ret;
pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->flags &= ~AV_PKT_FLAG_CORRUPT;