diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2019-12-10 22:59:53 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-12-12 19:25:33 +0100 |
commit | c1e439d7e9abab3cebdc937636393b1656e095d9 (patch) | |
tree | be0ae941a23b62c42b152e2b9aa0a22f8c793d4e /libavformat/rtpdec_qt.c | |
parent | cb88cdf7730e309df22ddbbc1ae4ebcd9ebc529e (diff) |
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>
Diffstat (limited to 'libavformat/rtpdec_qt.c')
-rw-r--r-- | libavformat/rtpdec_qt.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 77a3ce40be..740c382d07 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -48,13 +48,13 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, GetBitContext gb; int packing_scheme, has_payload_desc, has_packet_info, alen, has_marker_bit = flags & RTP_FLAG_MARKER, - keyframe; + keyframe, ret; if (qt->remaining) { int num = qt->pkt.size / qt->bytes_per_frame; - if (av_new_packet(pkt, qt->bytes_per_frame)) - return AVERROR(ENOMEM); + if ((ret = av_new_packet(pkt, qt->bytes_per_frame)) < 0) + return ret; pkt->stream_index = st->index; pkt->flags = qt->pkt.flags; memcpy(pkt->data, @@ -208,8 +208,8 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, alen % qt->bytes_per_frame != 0) return AVERROR_INVALIDDATA; /* wrongly padded */ qt->remaining = (alen / qt->bytes_per_frame) - 1; - if (av_new_packet(pkt, qt->bytes_per_frame)) - return AVERROR(ENOMEM); + if ((ret = av_new_packet(pkt, qt->bytes_per_frame)) < 0) + return ret; memcpy(pkt->data, buf + avio_tell(&pb), qt->bytes_per_frame); pkt->flags = keyframe ? AV_PKT_FLAG_KEY : 0; pkt->stream_index = st->index; |