diff mbox series

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

Message ID 20240701234733.3829130-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,v2] doc/examples/vaapi_encode: Try to check fwrite() for failure | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer July 1, 2024, 11:47 p.m. UTC
Fixes: CID1604548 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 doc/examples/vaapi_encode.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Xiang, Haihao July 9, 2024, 6:14 a.m. UTC | #1
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@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
Michael Niedermayer July 9, 2024, 12:40 p.m. UTC | #2
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@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

[...]
diff mbox series

Patch

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: