[FFmpeg-devel] [PATCH] fix speex sample

Michael Niedermayer michaelni
Thu Apr 2 21:59:57 CEST 2009

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


> 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)

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090402/22ce60ff/attachment.pgp>

More information about the ffmpeg-devel mailing list