diff mbox series

[FFmpeg-devel,2/3] api/api-band-test: Perform codec admissibility check earlier

Message ID AS8P250MB0744EFE75C0458A76FA0ACB28FC52@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,1/3] api/api-band-test: Remove write-only variable | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt June 9, 2024, 1:45 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 tests/api/api-band-test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/tests/api/api-band-test.c b/tests/api/api-band-test.c
index d40e31b850..e088d0854a 100644
--- a/tests/api/api-band-test.c
+++ b/tests/api/api-band-test.c
@@ -106,6 +106,11 @@  static int video_decode(const char *input_filename)
         return -1;
     }
 
+    if (strcmp(codec->name, "flv") && strcmp(codec->name, "mpeg4") && strcmp(codec->name, "huffyuv")) {
+        av_log(NULL, AV_LOG_ERROR, "Wrong codec\n");
+        return -1;
+    }
+
     ctx = avcodec_alloc_context3(codec);
     if (!ctx) {
         av_log(NULL, AV_LOG_ERROR, "Can't allocate decoder context\n");
@@ -139,11 +144,6 @@  static int video_decode(const char *input_filename)
         return AVERROR(ENOMEM);
     }
 
-    if (strcmp(codec->name, "flv") && strcmp(codec->name, "mpeg4") && strcmp(codec->name, "huffyuv")) {
-        av_log(NULL, AV_LOG_ERROR, "Wrong codec\n");
-        return -1;
-    }
-
     byte_buffer_size = av_image_get_buffer_size(ctx->pix_fmt, ctx->width, ctx->height, 32);
     byte_buffer = av_malloc(byte_buffer_size);
     if (!byte_buffer) {