[FFmpeg-devel] [PATCH] Stricter TMV probe
Vitor Sessak
vitor1001
Mon Sep 14 22:22:50 CEST 2009
Ronald S. Bultje wrote:
> Hi,
>
> On Mon, Sep 14, 2009 at 3:51 PM, Reimar D?ffinger
> <Reimar.Doeffinger at gmx.de> wrote:
>> Not really related to this specific patch, just because every probe
>> function checks sample_rate:
>> A lot of demuxers (including that one) do not validate it in
>> read_header, ending up with 1/0 as time base. That really is not ok (and
>> as said, I have the impression a lot of demuxers do that).
>
> I think just checking for != 0 isn't enough. A samplerate of 1 might
> be valid, but isn't. I mean, it wouldn't produce anything audible. A
> min. samplerate of e.g. 1000 seems appropriate, and for many gaming
> formats, a max of e.g. 192000 might also be useful.
One can do even better:
if(samplerate < 1000 || samplerate > 192000)
return 0;
switch (samplerate) {
case 8000:
case 11025:
case 22050:
case 44100:
case 48000:
// all known samplerates for the format
return AVPROBE_SCORE_MAX;
default:
return AVPROBE_SCORE_MAX / 4; // who knows?
}
-Vitor
More information about the ffmpeg-devel
mailing list