diff options
author | James Almer <jamrial@gmail.com> | 2023-06-19 23:35:37 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2023-06-21 13:31:14 -0300 |
commit | 43ace56c7e79aa94aa5437911e4a3424821d7ab6 (patch) | |
tree | a92a009a194ff238eb76ff1af3060e5b1546f403 /libavformat/evcdec.c | |
parent | 2276bcc52acf224da38eadb8068a8535260678e0 (diff) | |
download | ffmpeg-43ace56c7e79aa94aa5437911e4a3424821d7ab6.tar.gz |
avformat/evcdec: remove unnecessary av_packet_unref() calls
And return proper error codes.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/evcdec.c')
-rw-r--r-- | libavformat/evcdec.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libavformat/evcdec.c b/libavformat/evcdec.c index 9c4969e78f..68f3a91e53 100644 --- a/libavformat/evcdec.c +++ b/libavformat/evcdec.c @@ -186,11 +186,8 @@ static int evc_read_packet(AVFormatContext *s, AVPacket *pkt) EVCDemuxContext *const c = s->priv_data; - int eof = avio_feof (s->pb); - if(eof) { - av_packet_unref(pkt); + if (avio_feof(s->pb)) return AVERROR_EOF; - } while(!au_end_found) { uint8_t buf[EVC_NALU_LENGTH_PREFIX_SIZE]; @@ -200,16 +197,12 @@ static int evc_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; ret = avio_read(s->pb, (unsigned char *)&buf, EVC_NALU_LENGTH_PREFIX_SIZE); - if (ret < 0) { - av_packet_unref(pkt); + if (ret < 0) return ret; - } nalu_size = read_nal_unit_length((const uint8_t *)&buf, EVC_NALU_LENGTH_PREFIX_SIZE); - if(nalu_size <= 0) { - av_packet_unref(pkt); - return -1; - } + if (nalu_size <= 0) + return AVERROR_INVALIDDATA; avio_seek(s->pb, -EVC_NALU_LENGTH_PREFIX_SIZE, SEEK_CUR); @@ -217,7 +210,7 @@ static int evc_read_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) return ret; if (ret != (nalu_size + EVC_NALU_LENGTH_PREFIX_SIZE)) - return AVERROR(EIO); + return AVERROR_INVALIDDATA; ret = av_bsf_send_packet(c->bsf, pkt); if (ret < 0) { |