avformat/ilbc: Use av_get_packet

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-02-03 08:19:39 +01:00
parent d1ac645636
commit a3e78deb0a
1 changed files with 2 additions and 6 deletions

View File

@ -99,15 +99,11 @@ static int ilbc_read_packet(AVFormatContext *s,
AVCodecParameters *par = s->streams[0]->codecpar;
int ret;
if ((ret = av_new_packet(pkt, par->block_align)) < 0)
return ret;
if ((ret = av_get_packet(s->pb, pkt, par->block_align)) != par->block_align)
return ret < 0 ? ret : AVERROR_INVALIDDATA;
pkt->stream_index = 0;
pkt->pos = avio_tell(s->pb);
pkt->duration = par->block_align == 38 ? 160 : 240;
if ((ret = avio_read(s->pb, pkt->data, par->block_align)) != par->block_align) {
return ret < 0 ? ret : AVERROR(EIO);
}
return 0;
}