diff mbox series

[FFmpeg-devel,04/10] fftools/ffmpeg_sched: Explicitly return 0 on sch_enc_send() success

Message ID GV1P250MB0737CB016AED3D3E999FC85F8F362@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 432e287e27efa3e9bb19f85cbd3d617e6f33c220
Headers show
Series [FFmpeg-devel,01/10] doc/examples: Always use <> includes | expand

Checks

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

Commit Message

Andreas Rheinhardt March 25, 2024, 1:53 a.m. UTC
Do not return the return value of the last enc_send_to_dst()
call, as this would treat the last call differently from the
earlier calls; furthermore, sch_enc_send() explicitly documents
to always return 0 on success.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 fftools/ffmpeg_sched.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Andreas Rheinhardt March 27, 2024, 4:16 p.m. UTC | #1
Andreas Rheinhardt:
> Do not return the return value of the last enc_send_to_dst()
> call, as this would treat the last call differently from the
> earlier calls; furthermore, sch_enc_send() explicitly documents
> to always return 0 on success.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  fftools/ffmpeg_sched.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c
> index ec88017e21..30b2355eb6 100644
> --- a/fftools/ffmpeg_sched.c
> +++ b/fftools/ffmpeg_sched.c
> @@ -2344,15 +2344,13 @@ int sch_enc_send(Scheduler *sch, unsigned enc_idx, AVPacket *pkt)
>          ret = enc_send_to_dst(sch, enc->dst[i], finished, to_send);
>          if (ret < 0) {
>              av_packet_unref(to_send);
> -            if (ret == AVERROR_EOF) {
> -                ret = 0;
> +            if (ret == AVERROR_EOF)
>                  continue;
> -            }
>              return ret;
>          }
>      }
>  
> -    return ret;
> +    return 0;
>  }
>  
>  static int enc_done(Scheduler *sch, unsigned enc_idx)

Will apply patches 4-12 of this patchset tomorrow unless there are
objections.

- Andreas
diff mbox series

Patch

diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c
index ec88017e21..30b2355eb6 100644
--- a/fftools/ffmpeg_sched.c
+++ b/fftools/ffmpeg_sched.c
@@ -2344,15 +2344,13 @@  int sch_enc_send(Scheduler *sch, unsigned enc_idx, AVPacket *pkt)
         ret = enc_send_to_dst(sch, enc->dst[i], finished, to_send);
         if (ret < 0) {
             av_packet_unref(to_send);
-            if (ret == AVERROR_EOF) {
-                ret = 0;
+            if (ret == AVERROR_EOF)
                 continue;
-            }
             return ret;
         }
     }
 
-    return ret;
+    return 0;
 }
 
 static int enc_done(Scheduler *sch, unsigned enc_idx)