[FFmpeg-devel] [PATCH]Make loas probe more similar to mp3 probe

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Aug 6 21:21:18 CEST 2014

On Tuesday 05 August 2014 10:28:38 pm Carl Eugen Hoyos wrote:
> Attached patch copies one line from mp3dec.c into loasdec.c to force
> probing more data and fixes ticket #3821. An alternative is to remove 
> the offending line from mp3dec.c (it was added in 2006 or earlier).

I was unhappy about the patch and iiuc the actual problem is that the 
first audio track is initially probed with a score of 25 as h263 and 
with a score of 1 as mp3. 1 is not enough (so if I disable the h263 
probe the probe size is increased and loas is correctly detected) but 
the 25 are interpreted as the probe value of mp3.

New patch attached. It stops set_codec_from_probe_data() from 
returning probe scores for streams that are not ignored (FFmpeg 
doesn't autodetect h263 in mpeg streams) but I suspect it would 
still lead to a failure if the audio data is initially detected 
as h264 with a score of 25 so a more correct fix is welcome.

Please review, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6ebbe6c..558a141 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -265,7 +265,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
         { "mpegvideo", AV_CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },
         { 0 }
-    int score;
+    int score, probed_score = 0;
     AVInputFormat *fmt = av_probe_input_format3(pd, 1, &score);
     if (fmt && st->request_probe <= score) {
@@ -278,11 +278,12 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
             if (!strcmp(fmt->name, fmt_id_type[i].name)) {
                 st->codec->codec_id   = fmt_id_type[i].id;
                 st->codec->codec_type = fmt_id_type[i].type;
+                probed_score = score;
-    return score;
+    return probed_score;

More information about the ffmpeg-devel mailing list