On 01/06/12 06:55, Diego Biurrun wrote:
> On Thu, May 31, 2012 at 02:03:36PM -0700, Luca Barbato wrote:
>> Return consistently AVERROR_INVALIDDATA on invalid input.
> 
> Consistently return
> 
>> --- a/libavformat/flvenc.c
>> +++ b/libavformat/flvenc.c
>> @@ -197,7 +197,7 @@ static int flv_write_header(AVFormatContext *s)
>>              if(enc->codec_tag == 0) {
>>                  av_log(s, AV_LOG_ERROR, "video codec not compatible with 
>> flv\n");
>> -                return -1;
>> +                return AVERROR_INVALIDDATA;
>>              }
>> @@ -214,7 +214,7 @@ static int flv_write_header(AVFormatContext *s)
>>          default:
>>              av_log(s, AV_LOG_ERROR, "codec not compatible with flv\n");
>> -            return -1;
>> +            return AVERROR_INVALIDDATA;
>>  
>> @@ -425,7 +425,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
>> *pkt)
>>          if(flags == 0) {
>>              av_log(s, AV_LOG_ERROR, "video codec %X not compatible with 
>> flv\n",enc->codec_id);
>> -            return -1;
>> +            return AVERROR_INVALIDDATA;
>> @@ -442,14 +442,14 @@ static int flv_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>      default:
>> -        return AVERROR(EINVAL);
>> +        return AVERROR_INVALIDDATA;
>>      break;
>>      }
>>      if (enc->codec_id == CODEC_ID_H264) {
>>          /* check if extradata looks like MP4 */
>>          if (enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1) {
>>              if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0)
>> -                return -1;
>> +                return AVERROR_INVALIDDATA;
>> @@ -457,7 +457,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
>> *pkt)
>>      if (pkt->dts < -flv->delay) {
>>          av_log(s, AV_LOG_WARNING, "Packets are not in the proper order with 
>> "
>>                                    "respect to DTS\n");
>> -        return AVERROR(EINVAL);
>> +        return AVERROR_INVALIDDATA;
> 
> Some of these look like user-provided values to me, in which case
> AVERROR(EINVAL) would be the appropriate return code.  Am I wrong?

Either of them are fine, one interpretation is that the data being muxed
is invalid, and that's how it is used across avf.

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to