[libav-devel] [RFC PATCH 2/2] aacdec: Lower the number of frames required to detect ADTS

Martin Storsjö martin at martin.st
Tue Mar 11 15:09:21 CET 2014

For live audio streams, requiring 500 frames for a stream to
be detected is a bit overkill.

This allows live ADTS streams that aren't frame-aligned
to start up more quickly, e.g.
Since the probe buffer size is increased until a good enough
probe result is found, I'm not sure how much the previous
patch actually helps though. If a false positive stream e.g. has
got 200 matching frames but show mismatches after that, chances
are that we will first try with a small buffer finding e.g. 70
matching frames, which isn't enough. Next we double the probe
buffer size and find 140 matching frames, which we deem enough -
even if we would have realized that it's a mismatch if we would
have tried with an ever bigger probe buffer, which we won't since
we now regard 100 as enough.
 libavformat/aacdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index 3aee82b..be213d4 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -65,7 +65,7 @@ static int adts_aac_probe(AVProbeData *p)
     if (first_frames >= 3)
         return AVPROBE_SCORE_EXTENSION + 1;
-    else if (max_frames > 500)
+    else if (max_frames > 100)
     else if (max_frames >= 3)
         return AVPROBE_SCORE_EXTENSION / 2;
-- (Apple Git-47)

More information about the libav-devel mailing list