[FFmpeg-devel] [PATCH 07/11] doc/examples/vaapi_encode: Try to check fwrite() for failure
Rémi Denis-Courmont
remi at remlab.net
Mon Jul 1 10:53:31 EEST 2024
Le 1 juillet 2024 02:12:46 GMT+03:00, Michael Niedermayer <michael at niedermayer.cc> a écrit :
>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..805db7e5fd8 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(EIO);
Err, shouldn't that pass errno rather than blindly (and wrongly) assume that it's EIO? What if the error is ENOSPC?
>+ break;
>+ }
> }
>
> end:
More information about the ffmpeg-devel
mailing list