avformat: Remove unnecessary av_packet_unref()

Since bae8844e the packet will always be unreferenced when a demuxer
returns an error, so that a lot of calls to av_packet_unref() in lots of
demuxers are now redundant and can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Andreas Rheinhardt 2020-01-07 14:55:40 +01:00 committed by Marton Balint
parent bbea268aa8
commit 6a67d518d6
52 changed files with 17 additions and 108 deletions

View File

@ -141,7 +141,6 @@ static int handle_id3(AVFormatContext *s, AVPacket *pkt)
ret = av_append_packet(s->pb, pkt, ff_id3v2_tag_len(pkt->data) - pkt->size);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
@ -174,7 +173,6 @@ retry:
return ret;
if (ret < ADTS_HEADER_SIZE) {
av_packet_unref(pkt);
return AVERROR(EIO);
}
@ -185,7 +183,6 @@ retry:
av_assert2(append > 0);
ret = av_append_packet(s->pb, pkt, append);
if (ret != append) {
av_packet_unref(pkt);
return AVERROR(EIO);
}
if (!ff_id3v2_match(pkt->data, ID3v2_DEFAULT_MAGIC)) {
@ -201,13 +198,10 @@ retry:
fsize = (AV_RB32(pkt->data + 3) >> 13) & 0x1FFF;
if (fsize < ADTS_HEADER_SIZE) {
av_packet_unref(pkt);
return AVERROR_INVALIDDATA;
}
ret = av_append_packet(s->pb, pkt, fsize - pkt->size);
if (ret < 0)
av_packet_unref(pkt);
return ret;
}

View File

@ -78,7 +78,6 @@ static int adp_read_packet(AVFormatContext *s, AVPacket *pkt)
if (ret != size) {
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
av_shrink_packet(pkt, ret);

View File

@ -65,11 +65,9 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
if (ret != size) {
av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR(EIO);
}
if (AV_RB16(pkt->data) & 0x8000) {
av_packet_unref(pkt);
return AVERROR_EOF;
}
pkt->size = size;

View File

@ -153,7 +153,6 @@ static int amr_read_packet(AVFormatContext *s, AVPacket *pkt)
read = avio_read(s->pb, pkt->data + 1, size - 1);
if (read != size - 1) {
av_packet_unref(pkt);
if (read < 0)
return read;
return AVERROR(EIO);

View File

@ -419,7 +419,6 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}

View File

@ -114,7 +114,6 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
pkt->data[palette_size + 3] = (size >> 8) & 0xFF;
ret = avio_read(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
if (ret < size) {
av_packet_unref(pkt);
return AVERROR(EIO);
}

View File

@ -422,8 +422,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
dst += size;
avio_skip(s->pb, skip);
if (ret != size) {
av_packet_unref(pkt);
break;
return AVERROR(EIO);
}
}
pkt->duration = samples;

View File

@ -158,22 +158,19 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(pb, pkt->data + 1, datasize);
if (ret < datasize) {
ret = AVERROR(EIO);
goto fail;
return AVERROR(EIO);
}
datasize = avio_rl16(pb); /* palette size */
if (datasize) {
if (datasize != 768) {
av_log(s, AV_LOG_ERROR, "invalid palette size %u\n", datasize);
ret = AVERROR_INVALIDDATA;
goto fail;
return AVERROR_INVALIDDATA;
}
pkt->data[0] |= C93_HAS_PALETTE;
ret = avio_read(pb, pkt->data + pkt->size, datasize);
if (ret < datasize) {
ret = AVERROR(EIO);
goto fail;
return AVERROR(EIO);
}
pkt->size += 768;
}
@ -186,10 +183,6 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->data[0] |= C93_FIRST_FRAME;
}
return 0;
fail:
av_packet_unref(pkt);
return ret;
}
AVInputFormat ff_c93_demuxer = {

View File

@ -207,7 +207,6 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(pkt->data, cdxl->header, CDXL_HEADER_SIZE);
ret = avio_read(pb, pkt->data + CDXL_HEADER_SIZE, video_size);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
av_shrink_packet(pkt, CDXL_HEADER_SIZE + ret);

View File

@ -542,7 +542,6 @@ static int filter_packet(AVFormatContext *avf, ConcatStream *cs, AVPacket *pkt)
if (ret < 0) {
av_log(avf, AV_LOG_ERROR, "h264_mp4toannexb filter "
"failed to send input packet\n");
av_packet_unref(pkt);
return ret;
}
@ -592,7 +591,6 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
if (ret < 0)
return ret;
if ((ret = match_streams(avf)) < 0) {
av_packet_unref(pkt);
return ret;
}
if (packet_after_outpoint(cat, pkt)) {
@ -608,7 +606,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
}
break;
}
if ((ret = filter_packet(avf, cs, pkt)))
if ((ret = filter_packet(avf, cs, pkt)) < 0)
return ret;
st = cat->avf->streams[pkt->stream_index];

View File

@ -93,7 +93,6 @@ static int dfa_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!first) {
ret = av_append_packet(pb, pkt, 12);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
} else
@ -101,7 +100,6 @@ static int dfa_read_packet(AVFormatContext *s, AVPacket *pkt)
frame_size = AV_RL32(pkt->data + pkt->size - 8);
if (frame_size > INT_MAX - 4) {
av_log(s, AV_LOG_ERROR, "Too large chunk size: %"PRIu32"\n", frame_size);
av_packet_unref(pkt);
return AVERROR(EIO);
}
if (AV_RL32(pkt->data + pkt->size - 12) == MKTAG('E', 'O', 'F', 'R')) {
@ -115,7 +113,6 @@ static int dfa_read_packet(AVFormatContext *s, AVPacket *pkt)
}
ret = av_append_packet(pb, pkt, frame_size);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
}

View File

@ -200,7 +200,6 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(pb, &pkt->data[4], pkt_size);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
if (ret < pkt_size)

View File

@ -259,14 +259,12 @@ static int dss_sp_read_packet(AVFormatContext *s, AVPacket *pkt)
dss_sp_byte_swap(ctx, pkt->data, ctx->dss_sp_buf);
if (ctx->dss_sp_swap_byte < 0) {
ret = AVERROR(EAGAIN);
goto error_eof;
return AVERROR(EAGAIN);
}
return pkt->size;
error_eof:
av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR_EOF;
}
@ -308,7 +306,6 @@ static int dss_723_1_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data + offset,
size2 - offset);
if (ret < size2 - offset) {
av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR_EOF;
}
@ -318,7 +315,6 @@ static int dss_723_1_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data + offset, size - offset);
if (ret < size - offset) {
av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR_EOF;
}

View File

@ -210,7 +210,6 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
ret = avio_read(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
if(ret != size){
av_packet_unref(pkt);
return AVERROR(EIO);
}
if(pal_size) memcpy(pkt->data, pal, pal_size);

View File

@ -633,7 +633,6 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
case AV_CODEC_ID_ADPCM_EA_R3:
if (pkt->size < 4) {
av_log(s, AV_LOG_ERROR, "Packet is too short\n");
av_packet_unref(pkt);
return AVERROR_INVALIDDATA;
}
if (ea->audio_codec == AV_CODEC_ID_ADPCM_EA_R3)
@ -736,8 +735,6 @@ get_video_packet:
}
}
if (ret < 0 && partial_packet)
av_packet_unref(pkt);
if (ret >= 0 && hit_end && !packet_read)
return AVERROR(EAGAIN);

View File

@ -183,7 +183,6 @@ static int fits_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_bprint_finalize(&avbuf, &buf);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
@ -192,7 +191,6 @@ static int fits_read_packet(AVFormatContext *s, AVPacket *pkt)
av_freep(&buf);
ret = avio_read(s->pb, pkt->data + pkt->size, size);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}

View File

@ -225,7 +225,6 @@ static int flic_read_packet(AVFormatContext *s,
ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE,
size - FLIC_PREAMBLE_SIZE);
if (ret != size - FLIC_PREAMBLE_SIZE) {
av_packet_unref(pkt);
ret = AVERROR(EIO);
}
packet_read = 1;
@ -241,8 +240,8 @@ static int flic_read_packet(AVFormatContext *s,
ret = avio_read(pb, pkt->data, size);
if (ret != size) {
av_packet_unref(pkt);
ret = AVERROR(EIO);
break;
}
packet_read = 1;

View File

@ -69,7 +69,6 @@ static int g723_1_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data + 1, size - 1);
if (ret < size - 1) {
av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR_EOF;
}

View File

@ -182,7 +182,6 @@ static int gdv_read_packet(AVFormatContext *ctx, AVPacket *pkt)
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
AVPALETTE_SIZE);
if (!pal) {
av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
memcpy(pal, gdv->pal, AVPALETTE_SIZE);

View File

@ -62,7 +62,6 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
if (ret < GSM_BLOCK_SIZE) {
av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR(EIO);
}
pkt->duration = 1;

View File

@ -2225,7 +2225,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
if (ist->codecpar->codec_id != st->codecpar->codec_id) {
ret = set_stream_info_from_input_stream(st, pls, ist);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
}

View File

@ -185,7 +185,6 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
bytestream_put_le32(&buf, 0);
if ((ret = avio_read(pb, buf, image->size)) != image->size) {
av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR_INVALIDDATA;
}

View File

@ -313,7 +313,6 @@ static int idcin_read_packet(AVFormatContext *s,
return ret;
else if (ret != chunk_size) {
av_log(s, AV_LOG_ERROR, "incomplete packet\n");
av_packet_unref(pkt);
return AVERROR(EIO);
}
if (command == 1) {
@ -322,7 +321,6 @@ static int idcin_read_packet(AVFormatContext *s,
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
AVPALETTE_SIZE);
if (!pal) {
av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
memcpy(pal, palette, AVPALETTE_SIZE);

View File

@ -224,8 +224,7 @@ static int roq_read_packet(AVFormatContext *s,
ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
chunk_size);
if (ret != chunk_size) {
av_packet_unref(pkt);
ret = AVERROR(EIO);
return AVERROR(EIO);
}
packet_read = 1;

View File

@ -111,7 +111,6 @@ static int ilbc_read_packet(AVFormatContext *s,
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) {
av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR(EIO);
}

View File

@ -542,7 +542,6 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) {
av_packet_unref(pkt);
if (ret[0] < 0) {
res = ret[0];
} else if (ret[1] < 0) {

View File

@ -92,7 +92,6 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_append_packet(s->pb, pkt, size);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "failed to grow packet\n");
av_packet_unref(pkt);
return ret;
}
}

View File

@ -327,7 +327,6 @@ static int modplug_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->size = ModPlug_Read(modplug->f, pkt->data, AUDIO_PKT_SIZE);
if (pkt->size <= 0) {
av_packet_unref(pkt);
return pkt->size == 0 ? AVERROR_EOF : AVERROR(EIO);
}
return 0;

View File

@ -316,7 +316,6 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret2;
if ((ret2 = avio_read(pb, pkt->data, ret)) != ret) {
av_packet_unref(pkt);
return ret2 < 0 ? ret2 : AVERROR_EOF;
}

View File

@ -7890,7 +7890,6 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = cenc_filter(mov, st, sc, pkt, current_index);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}

View File

@ -169,7 +169,6 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
if(c->curbits)
avio_seek(s->pb, -4, SEEK_CUR);
if(ret < size){
av_packet_unref(pkt);
return ret < 0 ? ret : AVERROR(EIO);
}
pkt->size = ret + 4;

View File

@ -3133,7 +3133,6 @@ static int mpegts_raw_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = read_packet(s, pkt->data, ts->raw_packet_size, &data);
pkt->pos = avio_tell(s->pb);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
if (data != pkt->data)

View File

@ -359,8 +359,6 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
/* error or EOF occurred */
if (ret == AVERROR_EOF) {
ret = pkt->size > 0 ? pkt->size : AVERROR_EOF;
} else {
av_packet_unref(pkt);
}
}

View File

@ -83,7 +83,6 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
if (ret != size) {
if (ret > 0) av_packet_unref(pkt);
return AVERROR(EIO);
}

View File

@ -284,7 +284,6 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(pkt->data, hdr, copyhdrsize);
ret = avio_read(pb, pkt->data + copyhdrsize, size);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
if (ret < size)

View File

@ -851,7 +851,7 @@ retry:
AV_PKT_DATA_SKIP_SAMPLES,
10);
if(!side_data)
goto fail;
return AVERROR(ENOMEM);
AV_WL32(side_data + 4, os->end_trimming);
os->end_trimming = 0;
}
@ -861,7 +861,7 @@ retry:
AV_PKT_DATA_METADATA_UPDATE,
os->new_metadata_size);
if(!side_data)
goto fail;
return AVERROR(ENOMEM);
memcpy(side_data, os->new_metadata, os->new_metadata_size);
av_freep(&os->new_metadata);
@ -869,9 +869,6 @@ retry:
}
return psize;
fail:
av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index,

View File

@ -140,7 +140,6 @@ static int redspark_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
if (ret != size) {
av_packet_unref(pkt);
return AVERROR(EIO);
}

View File

@ -256,7 +256,6 @@ static int rl2_read_packet(AVFormatContext *s,
/** fill the packet */
ret = av_get_packet(pb, pkt, sample->size);
if(ret != sample->size){
av_packet_unref(pkt);
return AVERROR(EIO);
}

View File

@ -338,7 +338,6 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
if (ret < 0)
return ret;
if (ret != frame_size) {
av_packet_unref(pkt);
return AVERROR(EIO);
}
pkt->duration = 1;
@ -355,7 +354,6 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
if (ret < 0)
return ret;
if (ret != index_entry->size) {
av_packet_unref(pkt);
return AVERROR(EIO);
}

View File

@ -174,7 +174,6 @@ static int s337m_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pos = pos;
if (avio_read(pb, pkt->data, pkt->size) < pkt->size) {
av_packet_unref(pkt);
return AVERROR_EOF;
}
@ -186,7 +185,6 @@ static int s337m_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!s->nb_streams) {
AVStream *st = avformat_new_stream(s, NULL);
if (!st) {
av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -225,7 +225,6 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
int i = s->nb_streams;
AVStream *st = avformat_new_stream(s, NULL);
if (!st) {
av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
st->id = i;

View File

@ -95,7 +95,6 @@ static int sdr2_read_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(pkt->data, header, 24);
ret = avio_read(s->pb, pkt->data + 24, next - 52);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
}
av_shrink_packet(pkt, ret + 24);

View File

@ -295,7 +295,6 @@ static int vmd_read_packet(AVFormatContext *s,
frame->frame_size);
if (ret != frame->frame_size) {
av_packet_unref(pkt);
ret = AVERROR(EIO);
}
pkt->stream_index = frame->stream_index;

View File

@ -220,7 +220,6 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
if (c->gmcsize)
memcpy(pkt->data + 2, c->gmc, c->gmcsize);
if (avio_read(s->pb, pkt->data + 2 + c->gmcsize, size) != size) {
av_packet_unref(pkt);
return AVERROR_INVALIDDATA;
}
pkt->stream_index = 0;

View File

@ -197,15 +197,13 @@ int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pos = avio_tell(pb) - BURST_HEADER_SIZE;
if (avio_read(pb, pkt->data, pkt->size) < pkt->size) {
av_packet_unref(pkt);
return AVERROR_EOF;
}
ff_spdif_bswap_buf16((uint16_t *)pkt->data, (uint16_t *)pkt->data, pkt->size >> 1);
ret = spdif_get_offset_and_codec(s, data_type, pkt->data,
&offset, &codec_id);
if (ret) {
av_packet_unref(pkt);
if (ret < 0) {
return ret;
}
@ -216,7 +214,6 @@ int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
/* first packet, create a stream */
AVStream *st = avformat_new_stream(s, NULL);
if (!st) {
av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -399,7 +399,6 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
if (linesize * height > pkt->size) {
res = AVERROR_INVALIDDATA;
av_packet_unref(pkt);
goto bitmap_end;
}
@ -489,7 +488,6 @@ bitmap_end_skip:
if ((res = av_new_packet(pkt, len)) < 0)
return res;
if (avio_read(pb, pkt->data, 4) != 4) {
av_packet_unref(pkt);
return AVERROR_INVALIDDATA;
}
if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
@ -506,7 +504,6 @@ bitmap_end_skip:
}
if (res != pkt->size) {
if (res < 0) {
av_packet_unref(pkt);
return res;
}
av_shrink_packet(pkt, res);

View File

@ -181,7 +181,6 @@ static int thp_read_packet(AVFormatContext *s,
if (ret < 0)
return ret;
if (ret != size) {
av_packet_unref(pkt);
return AVERROR(EIO);
}
@ -191,7 +190,6 @@ static int thp_read_packet(AVFormatContext *s,
if (ret < 0)
return ret;
if (ret != thp->audiosize) {
av_packet_unref(pkt);
return AVERROR(EIO);
}

View File

@ -273,32 +273,28 @@ restart:
}
if ((ret = av_get_packet(pb, pkt, vivo->length)) < 0)
goto fail;
return ret;
// get next packet header
if ((ret = vivo_get_packet_header(s)) < 0)
goto fail;
return ret;
while (vivo->sequence == old_sequence &&
(((vivo->type - 1) >> 1) == ((old_type - 1) >> 1))) {
if (avio_feof(pb)) {
ret = AVERROR_EOF;
break;
return AVERROR_EOF;
}
if ((ret = av_append_packet(pb, pkt, vivo->length)) < 0)
break;
return ret;
// get next packet header
if ((ret = vivo_get_packet_header(s)) < 0)
break;
return ret;
}
pkt->stream_index = stream_index;
fail:
if (ret < 0)
av_packet_unref(pkt);
return ret;
}

View File

@ -93,9 +93,7 @@ static int vpk_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data + i * size, size);
avio_skip(s->pb, skip);
if (ret != size) {
av_packet_unref(pkt);
ret = AVERROR(EIO);
break;
return AVERROR(EIO);
}
}
pkt->stream_index = 0;

View File

@ -249,7 +249,6 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = avio_read(s->pb, pkt->data+2, size);
if (ret != size) {
av_packet_unref(pkt);
return AVERROR(EIO);
}

View File

@ -287,25 +287,21 @@ static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(pkt->data, wc->block_header, WV_HEADER_SIZE);
ret = avio_read(s->pb, pkt->data + WV_HEADER_SIZE, wc->header.blocksize);
if (ret != wc->header.blocksize) {
av_packet_unref(pkt);
return AVERROR(EIO);
}
while (!(wc->header.flags & WV_FLAG_FINAL_BLOCK)) {
if ((ret = wv_read_block_header(s, s->pb)) < 0) {
av_packet_unref(pkt);
return ret;
}
off = pkt->size;
if ((ret = av_grow_packet(pkt, WV_HEADER_SIZE + wc->header.blocksize)) < 0) {
av_packet_unref(pkt);
return ret;
}
memcpy(pkt->data + off, wc->block_header, WV_HEADER_SIZE);
ret = avio_read(s->pb, pkt->data + off + WV_HEADER_SIZE, wc->header.blocksize);
if (ret != wc->header.blocksize) {
av_packet_unref(pkt);
return (ret < 0) ? ret : AVERROR_EOF;
}
}

View File

@ -314,7 +314,6 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
if (ret < 0)
return ret;
else if (ret != s->packet_size - Y4M_FRAME_MAGIC_LEN) {
av_packet_unref(pkt);
return s->pb->eof_reached ? AVERROR_EOF : AVERROR(EIO);
}
pkt->stream_index = 0;