[Ffmpeg-devel] [RFC] faad/rtsp/aac bug...
Ryan Martell
rdm4
Tue Oct 31 01:38:44 CET 2006
Hi--
So there's a bug in rtsp.c/faad, that I could use a suggestion on
fixing.
1) in rtsp.c:
codec->sample_rate = i;
get_word_sep(buf, sizeof(buf), "/", &p);
i = atoi(buf);
if (i > 0)
codec->channels = i;
// TODO: there is a bug here; if it is a mono
stream, and less than 22000Hz, faad upconverts to stereo and twice the
// frequency. No problem, but the sample rate
is being set here by the sdp line. Upcoming patch forthcoming. (rdm)
2) In faad.c:
if (avctx->extradata){
r = s->faacDecInit2(s->faac_handle, (uint8_t*) avctx-
>extradata,
avctx->extradata_size,
&samplerate, &channels);
if (r < 0){
av_log(avctx, AV_LOG_ERROR,
"faacDecInit2 failed r:%d sr:%ld ch:%ld s:%d\n",
r, samplerate, (long)channels, avctx-
>extradata_size);
} else {
avctx->sample_rate = samplerate;
avctx->channels = channels;
s->init = 1;
}
}
3) The extradata specifies the channel count and the frequency. In
my case, it specifies it as a 22050/1, which is also what the SDP
line says.
4) in the faad code, if the frequency is lower than a 22000Hz, it
doubles the frequency, and if it is a mono channel, it doubles it to
stereo.
The hardware buffers are opened in ffplay, after the rtsp stuff is
parsed but before the aac code is called that tells it to
upconvert. As a result, if it is a 22050 mono stream, it is really
slow sounding.
I could include the logic from aac that talks about how to do this
(based on the extradata), but I believe that the upconversion/
doubling of channels might just be a faad thing, and put that in the
rtp code, but that seems potentially buggy.
Any advice on where/how to fix this cleanly would be appreciated.
Thanks!
-Ryan
More information about the ffmpeg-devel
mailing list