Attached patch is a quick fix for Ticket4723.
I have a couple of issues with this though:
1. It seems like probe thresholds are essentially tweaked based on
what files are encountered, and that these can't be set precisely
according to a spec.
Is this correct?

2. Comment in the file mentions keeping probing in sync across ac3/mp3.
I kept this in mind for the patch, but don't know the rationale for this.

2. I tested the patch with fate and against the ticket.
However, ideally this should be tested against a variety of mp3/ac3 files,
to make sure the probing still works even with this stricter threshold
for detection.
Where can I find comprehensive sample files for this purpose,
and more generally audio/video files for ffmpeg development?

Thanks,
Ganesh
From f449758984ba34c6c1818d88015cd682d9afd36e Mon Sep 17 00:00:00 2001
From: Ganesh Ajjanagadde <gajjanaga...@gmail.com>
Date: Fri, 17 Jul 2015 22:09:48 -0400
Subject: [PATCH] avformat: increase first_frames threshold for mp3,ac3

Fixes Ticket4723

Signed-off-by: Ganesh Ajjanagadde <gajjanaga...@gmail.com>
---
 libavformat/ac3dec.c | 2 +-
 libavformat/mp3dec.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c
index 58ef44d..bef55cb 100644
--- a/libavformat/ac3dec.c
+++ b/libavformat/ac3dec.c
@@ -80,7 +80,7 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id)
     if(codec_id != expected_codec_id) return 0;
     // keep this in sync with mp3 probe, both need to avoid
     // issues with MPEG-files!
-    if   (first_frames>=4) return AVPROBE_SCORE_EXTENSION + 1;
+    if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
     else if(max_frames>200)return AVPROBE_SCORE_EXTENSION;
     else if(max_frames>=4) return AVPROBE_SCORE_EXTENSION/2;
     else if(max_frames>=1) return 1;
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 731dc63..20af7bc 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -98,7 +98,7 @@ static int mp3_read_probe(AVProbeData *p)
     avcodec_free_context(&avctx);
     // keep this in sync with ac3 probe, both need to avoid
     // issues with MPEG-files!
-    if   (first_frames>=4) return AVPROBE_SCORE_EXTENSION + 1;
+    if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
     else if(max_frames>200)return AVPROBE_SCORE_EXTENSION;
     else if(max_frames>=4 && max_frames >= p->buf_size/10000) return AVPROBE_SCORE_EXTENSION / 2;
     else if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size)
-- 
2.4.6

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to