[FFmpeg-devel] [PATCH v2] doc/examples/vaapi_encode: Try to check fwrite() for failure

Xiang, Haihao haihao.xiang at intel.com
Tue Jul 9 09:14:17 EEST 2024


On Di, 2024-07-02 at 01:47 +0200, Michael Niedermayer wrote:
> Fixes: CID1604548 Unused value
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  doc/examples/vaapi_encode.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c
> index d5f472f6dd8..ff3ebb1e2b8 100644
> --- a/doc/examples/vaapi_encode.c
> +++ b/doc/examples/vaapi_encode.c
> @@ -88,6 +88,10 @@ static int encode_write(AVCodecContext *avctx, AVFrame
> *frame, FILE *fout)
>          enc_pkt->stream_index = 0;
>          ret = fwrite(enc_pkt->data, enc_pkt->size, 1, fout);
>          av_packet_unref(enc_pkt);
> +        if (ret != enc_pkt->size) {
> +            ret = AVERROR(errno);
> +            break;
> +        }
>      }
>  
>  end:

LGTM

- Haihao



More information about the ffmpeg-devel mailing list