[FFmpeg-devel] [PATCH 13/18] lavf/dv: return a meaningful error code from avpriv_dv_produce_packet()

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Aug 24 16:07:28 EEST 2022


Anton Khirnov:
> ---
>  libavdevice/iec61883.c | 2 +-
>  libavformat/dv.c       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavdevice/iec61883.c b/libavdevice/iec61883.c
> index 7223ba2e64..a4b4ce2ef8 100644
> --- a/libavdevice/iec61883.c
> +++ b/libavdevice/iec61883.c
> @@ -209,7 +209,7 @@ static int iec61883_parse_queue_dv(struct iec61883_data *dv, AVPacket *pkt)
>      dv->packets--;
>  
>      if (size < 0)
> -        return -1;
> +        return size;

Did you test this? iec61883_read_packet() explicitly checks for -1 and
not for < 0 for failure. It should work if you also modify
iec61883_read_packet(), but I never changed this because I don't like to
change code that I can't test.

- Andreas

>  
>      if (av_packet_from_data(pkt, pkt->data, pkt->size) < 0) {
>          av_freep(&pkt->data);
> diff --git a/libavformat/dv.c b/libavformat/dv.c
> index f88fe62349..c888111789 100644
> --- a/libavformat/dv.c
> +++ b/libavformat/dv.c
> @@ -404,7 +404,7 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
>      if (buf_size < DV_PROFILE_BYTES ||
>          !(c->sys = av_dv_frame_profile(c->sys, buf, buf_size)) ||
>          buf_size < c->sys->frame_size) {
> -        return -1;   /* Broken frame, or not enough data */
> +        return AVERROR_INVALIDDATA;
>      }
>  
>      /* Queueing audio packet */



More information about the ffmpeg-devel mailing list