[libav-devel] [PATCH] h264: Use AVERROR return codes instead of -1

Jake Sebastian-Jones jake.sebastian-jones at linux.com
Thu Aug 6 04:42:16 CEST 2015


Okay cool I'll try another one.

On Wed, Aug 5, 2015 at 7:39 PM, Luca Barbato <lu_zero at gentoo.org> wrote:

> On 05/08/15 11:03, Martin Storsjö wrote:
> > On Wed, 5 Aug 2015, Luca Barbato wrote:
> >
> >> From: Jake Sebastian-Jones <jake.sebastian-jones at linux.com>
> >>
> >> And report why it fails.
> >>
> >> Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> >> ---
> >>
> >> You can write comments to patches below the --- marker,
> >> I use git send-email --annotate to do that.
> >>
> >> Here your amended patch I changed the commit title and message
> >> according to https://wiki.libav.org/GitCommit and modified
> >> the patch to match the https://wiki.libav.org/CodingStyle
> >> The log now is a bit more informative.
> >>
> >> libavcodec/h264.c | 11 ++++++++---
> >> 1 file changed, 8 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> >> index 7c2b307..9b495c5 100644
> >> --- a/libavcodec/h264.c
> >> +++ b/libavcodec/h264.c
> >> @@ -1273,15 +1273,20 @@ static int get_avc_nalsize(H264Context *h,
> >> const uint8_t *buf,
> >> {
> >>     int i, nalsize = 0;
> >>
> >> -    if (*buf_index >= buf_size - h->nal_length_size)
> >> -        return -1;
> >> +    if (*buf_index >= buf_size - h->nal_length_size) {
> >> +        av_log(h->avctx, AV_LOG_ERROR,
> >> +               "AVC: The buffer size %d is too short to read "
> >> +               "the nal length size %d at the offset %d.",
> >> +               buf_size, h->nal_length_size, *buf_index);
> >> +        return AVERROR_INVALIDDATA;
> >> +    }
> >
> > Missing newline at the end of the log message
> >
> > Other than that it's ok
> >
>
> Thanks for spotting it =)
>
> lu
>
> _______________________________________________
> libav-devel mailing list
> libav-devel at libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
>



-- 
PGP key for this address:
http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x1764BF01AA32D107


More information about the libav-devel mailing list