[FFmpeg-cvslog] aacdec: Don't count probed ADTS frames if there are false positives

Martin Storsjö git at videolan.org
Sun Mar 16 22:38:21 CET 2014


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Mar 11 15:42:44 2014 +0200| [0412cb67cda05b08dfca6bfc4ff664ea917fa932] | committer: Martin Storsjö

aacdec: Don't count probed ADTS frames if there are false positives

If a portion of the probe buffer seem to resemble ADTS frames,
but some data at the end is a mismatch, disregard the whole
probing attempt. If it actually is ADTS data, there shouldn't be
any mismatches within the sequential frame data.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0412cb67cda05b08dfca6bfc4ff664ea917fa932
---

 libavformat/aacdec.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index b9a4b4b..f5d0c69 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -42,8 +42,16 @@ static int adts_aac_probe(AVProbeData *p)
 
         for (frames = 0; buf2 < end; frames++) {
             uint32_t header = AV_RB16(buf2);
-            if ((header & 0xFFF6) != 0xFFF0)
+            if ((header & 0xFFF6) != 0xFFF0) {
+                if (buf != buf0) {
+                    // Found something that isn't an ADTS header, starting
+                    // from a position other than the start of the buffer.
+                    // Discard the count we've accumulated so far since it
+                    // probably was a false positive.
+                    frames = 0;
+                }
                 break;
+            }
             fsize = (AV_RB32(buf2 + 3) >> 13) & 0x1FFF;
             if (fsize < 7)
                 break;



More information about the ffmpeg-cvslog mailing list