[FFmpeg-devel] [PATCH] fix speex sample

Baptiste Coudurier baptiste.coudurier
Thu Apr 2 23:45:25 CEST 2009


Michael Niedermayer wrote:
> On Thu, Apr 02, 2009 at 12:17:18PM -0700, Baptiste Coudurier wrote:
>> Hi
>> 
>> Sample testingSpeex.flv Problem is that the code above is setting
>> sample rate according to the value stored, but for speex and
>> nellymoser 8lhz sample rate is fixed and the values stored is 0.
>> 
>> One possibility is the to always call set_audio_codec according to
>> what is stored in the packet, the function will correctly set
>> sample rate for speex and nellymoser 8khz. We could also special
>> case these 2 codecs.
>> 
>> I checked when the "if" above was added, and it seems that was for 
>> K70707-ARIA229.flv. I checked that with my patch, file is still
>> detected correctly.
>> 
> 
>> Btw Michael, if you want, I volunteer to maintain FLV code if it
>> can helps, to do cleanup, simplification, and fix bugs.
> 
> i would prefer to review all changes that might change behavior of
> flvdec

It's up to you, but you are also the first person in charge of fixing
bugs, as the flv maintainer.

> [...]
> 
>> Index: libavformat/flvdec.c 
>> ===================================================================
>>  --- libavformat/flvdec.c	(revision 18316) +++ libavformat/flvdec.c
>> (working copy) @@ -399,9 +399,7 @@
> 
>> st->codec->sample_rate = (44100 << ((flags &
>> FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3);
> 
> the bug is in this line, this is clearly not correct for nelly&speex
> 
> your proposed change will break flv files that really use a non
> standard samplerate. (no i have no such file, its just hypothetical,
> but IMHO if the file says samplerate=X and X!= 0 then this should be
> used)

Point is to override sample for nelly 8khz and speex, this code is
already present in set_audio_codec.

If you want to duplicate this code before this line, feel free to do so.

There is no case where storing a wrong sample would be necessary nor
supported. Specifications clearly states so.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
checking for life_signs in -lkenny... no
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list