[FFmpeg-devel] [FFmpeg-cvslog] 8svx: Return proper error codes

Michael Niedermayer michaelni at gmx.at
Wed Sep 3 02:31:10 CEST 2014


On Tue, Sep 02, 2014 at 10:03:39PM +0200, Clément Bœsch wrote:
> On Tue, Sep 02, 2014 at 09:54:31PM +0200, Gabriel Dume wrote:
> > ffmpeg | branch: master | Gabriel Dume <gabriel.ddx84 at gmail.com> | Mon Sep  1 15:18:57 2014 -0400| [74512f7e369da40e1148c92b58cd8e59f7737b8f] | committer: Diego Biurrun
> > 
> > 8svx: Return proper error codes
> > 
> > Signed-off-by: Diego Biurrun <diego at biurrun.de>
> > 
> > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74512f7e369da40e1148c92b58cd8e59f7737b8f
> > ---
> > 
> >  libavcodec/8svx.c |   10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
> > index 11fbf19..b973771 100644
> > --- a/libavcodec/8svx.c
> > +++ b/libavcodec/8svx.c
> > @@ -96,11 +96,11 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
> >  
> >          if (avpkt->size < hdr_size * avctx->channels) {
> >              av_log(avctx, AV_LOG_ERROR, "packet size is too small\n");
> > -            return AVERROR(EINVAL);
> > +            return AVERROR_INVALIDDATA;
> >          }
> >          if (esc->data[0]) {
> >              av_log(avctx, AV_LOG_ERROR, "unexpected data after first packet\n");
> > -            return AVERROR(EINVAL);
> > +            return AVERROR_INVALIDDATA;
> >          }
> >  
> >          if (is_compr) {
> > @@ -125,7 +125,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
> >      }
> >      if (!esc->data[0]) {
> >          av_log(avctx, AV_LOG_ERROR, "unexpected empty packet\n");
> > -        return AVERROR(EINVAL);
> > +        return AVERROR_INVALIDDATA;
> >      }
> >  
> >      /* decode next piece of data from the buffer */
> > @@ -166,7 +166,7 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
> >  
> >      if (avctx->channels < 1 || avctx->channels > 2) {
> >          av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n");
> > -        return AVERROR(EINVAL);
> > +        return AVERROR_INVALIDDATA;
> 
> Isn't this a user settable option? EINVAL was appropriate then.

from an applications point of view yes
OTOH one could argue its invalid in the headers from the container

> 
> >      }
> >  
> >      switch(avctx->codec->id) {
> > @@ -179,7 +179,7 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
> >          case AV_CODEC_ID_PCM_S8_PLANAR:
> >              break;
> >          default:
> > -          return -1;
> > +          return AVERROR_INVALIDDATA;
> 
> AVERROR_BUG, or EINVAL maybe?
> 
> Unless I'm mistaken this is set depending on the selected decoder. It
> looks unrelated to the stream data anyway.

seems so, yes


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140903/001d5dc8/attachment.asc>


More information about the ffmpeg-devel mailing list