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

Luca Barbato lu_zero at gentoo.org
Wed Aug 5 11:39:43 CEST 2015


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



More information about the libav-devel mailing list