[FFmpeg-devel] [PATCH] tools/target_bsf_fuzzer: simplify the loop feeding packets to the filter

James Almer jamrial at gmail.com
Thu Feb 24 02:39:26 EET 2022


This also follows the suggested API usage in the doxy.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 tools/target_bsf_fuzzer.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/tools/target_bsf_fuzzer.c b/tools/target_bsf_fuzzer.c
index d6aaee3bd9..1aae4a12e5 100644
--- a/tools/target_bsf_fuzzer.c
+++ b/tools/target_bsf_fuzzer.c
@@ -146,16 +146,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
             av_bsf_flush(bsf);
         flushpattern = (flushpattern >> 3) + (flushpattern << 61);
 
-        while (in->size) {
-            res = av_bsf_send_packet(bsf, in);
-            if (res < 0 && res != AVERROR(EAGAIN))
-                break;
-            res = av_bsf_receive_packet(bsf, out);
-            if (res < 0)
-                break;
-            av_packet_unref(out);
+        res = av_bsf_send_packet(bsf, in);
+        if (res < 0) {
+            av_packet_unref(in);
+            continue;
         }
-        av_packet_unref(in);
+        while ((res = av_bsf_receive_packet(bsf, out)) >= 0);
+            av_packet_unref(out);
     }
 
     res = av_bsf_send_packet(bsf, NULL);
-- 
2.35.1



More information about the ffmpeg-devel mailing list