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

Michael Niedermayer michael at niedermayer.cc
Tue Jul 9 15:40:42 EEST 2024


On Tue, Jul 09, 2024 at 06:14:17AM +0000, Xiang, Haihao wrote:
> 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

will apply

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240709/dc457775/attachment.sig>


More information about the ffmpeg-devel mailing list