diff options
author | James Almer <jamrial@gmail.com> | 2021-01-29 10:20:21 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2021-03-17 15:06:49 -0300 |
commit | 83a320226c16d2a6aaf63a11e1d68d53644dc123 (patch) | |
tree | cc795b6458ddc25823247e6ab977e388daaaa9c6 /libavformat/flacdec.c | |
parent | 453021c74e2ca8abcb86c4e503ed1eefa91c23de (diff) | |
download | ffmpeg-83a320226c16d2a6aaf63a11e1d68d53644dc123.tar.gz |
avformat/flacdec: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/flacdec.c')
-rw-r--r-- | libavformat/flacdec.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 6aca4755a1..f7b21986dc 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -259,7 +259,7 @@ static int flac_probe(const AVProbeData *p) static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit) { - AVPacket pkt; + AVPacket *pkt = s->internal->parse_pkt; AVStream *st = s->streams[stream_index]; AVCodecParserContext *parser; int ret; @@ -268,7 +268,6 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde if (avio_seek(s->pb, *ppos, SEEK_SET) < 0) return AV_NOPTS_VALUE; - av_init_packet(&pkt); parser = av_parser_init(st->codecpar->codec_id); if (!parser){ return AV_NOPTS_VALUE; @@ -279,20 +278,20 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde uint8_t *data; int size; - ret = ff_raw_read_partial_packet(s, &pkt); + ret = ff_raw_read_partial_packet(s, pkt); if (ret < 0){ if (ret == AVERROR(EAGAIN)) continue; else { - av_packet_unref(&pkt); - av_assert1(!pkt.size); + av_packet_unref(pkt); + av_assert1(!pkt->size); } } av_parser_parse2(parser, st->internal->avctx, - &data, &size, pkt.data, pkt.size, - pkt.pts, pkt.dts, *ppos); + &data, &size, pkt->data, pkt->size, + pkt->pts, pkt->dts, *ppos); - av_packet_unref(&pkt); + av_packet_unref(pkt); if (size) { if (parser->pts != AV_NOPTS_VALUE){ // seeking may not have started from beginning of a frame |