[FFmpeg-devel] [PATCH] avformat/amr: reduce raw amr false positive detection

Paul B Mahol onemda at gmail.com
Wed Oct 2 21:11:07 EEST 2019


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/amr.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavformat/amr.c b/libavformat/amr.c
index 42840a50a3..600cb1b0f0 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -190,9 +190,12 @@ static int amrnb_probe(const AVProbeData *p)
                 if (b[++i] != last)
                     break;
             }
-            if (size > 0) {
-                valid++;
-                i += size;
+            while (size--) {
+                if (b[i])
+                    valid++;
+                else
+                    invalid++;
+                i++;
             }
         } else {
             valid = 0;
@@ -246,9 +249,12 @@ static int amrwb_probe(const AVProbeData *p)
                 if (b[++i] != last)
                     break;
             }
-            if (size > 0) {
-                valid++;
-                i += size;
+            while (size--) {
+                if (b[i])
+                    valid++;
+                else
+                    invalid++;
+                i++;
             }
         } else {
             valid = 0;
-- 
2.17.1



More information about the ffmpeg-devel mailing list