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

Submitted by Paul B Mahol on Oct. 2, 2019, 6:11 p.m.

Details

Message ID 20191002181107.27360-1-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol Oct. 2, 2019, 6:11 p.m.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavformat/amr.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

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;