diff mbox series

[FFmpeg-devel,15/24] sws: merge handling frame start into a single block

Message ID 20210531075515.19544-15-anton@khirnov.net
State Accepted
Commit ff753f41dd3dbe7b71c314ecfe4b9dd89e059f57
Headers show
Series [FFmpeg-devel,01/24] sws: remove unnecessary braces | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Anton Khirnov May 31, 2021, 7:55 a.m. UTC
Also, return an error code on failure rather than 0.
---
 libswscale/swscale.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer June 1, 2021, 12:31 p.m. UTC | #1
On Mon, May 31, 2021 at 09:55:06AM +0200, Anton Khirnov wrote:
> Also, return an error code on failure rather than 0.
> ---
>  libswscale/swscale.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

LGTM

thx

[...]
diff mbox series

Patch

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 74da1bf42c..73bc0c5617 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -912,11 +912,12 @@  int attribute_align_arg sws_scale(struct SwsContext *c,
     if (srcSliceH == 0)
         return 0;
 
-    if (frame_start && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
-        av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
-        return 0;
-    }
     if (frame_start) {
+        if (srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
+            av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
+            return AVERROR(EINVAL);
+        }
+
         if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1;
     }