mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-06 15:49:50 +08:00
avformat: Forward errors where possible
It is not uncommon to find code where the caller thinks to know better what the return value should be than the callee. E.g. something like "if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit changes several instances of this to instead forward the actual error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:

committed by
Michael Niedermayer

parent
cb88cdf773
commit
c1e439d7e9
@ -74,7 +74,7 @@ static int get_codec_data(AVFormatContext *s, AVIOContext *pb, AVStream *vst,
|
||||
if (!vst && !myth)
|
||||
return 1; // no codec data needed
|
||||
while (!avio_feof(pb)) {
|
||||
int size, subtype;
|
||||
int size, subtype, ret;
|
||||
|
||||
frametype = avio_r8(pb);
|
||||
switch (frametype) {
|
||||
@ -87,8 +87,8 @@ static int get_codec_data(AVFormatContext *s, AVIOContext *pb, AVStream *vst,
|
||||
av_freep(&vst->codecpar->extradata);
|
||||
vst->codecpar->extradata_size = 0;
|
||||
}
|
||||
if (ff_get_extradata(NULL, vst->codecpar, pb, size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
if ((ret = ff_get_extradata(NULL, vst->codecpar, pb, size)) < 0)
|
||||
return ret;
|
||||
size = 0;
|
||||
if (!myth)
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user