[FFmpeg-devel] [PATCH] SHOUTcast HTTP Support
MIcah Galizia
micahgalizia
Sat Feb 27 21:51:37 CET 2010
[...]
>> +
>> + p->filename = s->filename;
>> + p->buf_size = buf_size;
>> +
>> + if (!(p->buf = av_malloc(p->buf_size))) {
>> + av_free(p);
>> + return NULL;
>> + }
>> +
>> + memcpy(p->buf, buffer, p->buf_size);
>
> and why not p->buf= buffer;
> ?
>
> thats besides your malloc() being to small and segfaulting
> (see AVPROBE_PADDING_SIZE)
>
> also this code is a buggy copy of what is in
> av_open_input_file()
> you need to successifly double the buffer size until PROBE_BUF_MAX
> there are also early termination conditions that we cannot just drop
>
> I think the only way to do this is to split the probing loop out of
> av_open_input_file() in a seperate patch and then use it
I have moved the probe loop into its own method and it is working for
ogg (because ogg_probe is so simple), but it causes a problem for mp3
streams due to the minimum score we require when probing the stream. In
utils.c, unless we have reached the max probe buffer size, score_max is
25 and unless the demuxer returns a probe score > 25, that demuxer will
not be used.
The mp3 demuxer does not return > 25 unless max_frames > 500 or
first_frames > 4. I don't know anything about those frames (or what
they do), but I have observed that those conditions are not met until we
have read 256Kb (on a local file and a stream without icy). However, in
a shoutcast stream, the interleaved metadata is included after only 32K.
This causes problems, as I cannot keep track of the metadata (since we
read way beyond it) and the metadata is also causing problems for the
mp3 demuxer. Additionally, reconnecting this many times (closing and
reconnecting each time the buffer size is doubled from 2K to 256K) makes
opening the stream _really_ slow.
What I would like to do to resolve this, is require that the piece of
code calling the probe method specify the score required as a parameter.
That way, the shoutcast demuxer could lower the requirements (maybe
AVPROBE_SCORE_MAX/10) and utils.c could maintain 25 (AVPROBE_SCORE_MAX/4).
Any thoughts?
--
Micah F. Galizia
micahgalizia at gmail.com
"The mark of an immature man is that he wants to die nobly for a cause,
while the mark of the mature man is that he wants to live humbly for
one." --W. Stekel
More information about the ffmpeg-devel
mailing list