[FFmpeg-devel] [PATCH] SHOUTcast HTTP Support

Michael Niedermayer michaelni
Sun Feb 28 17:43:55 CET 2010


On Sat, Feb 27, 2010 at 03:51:37PM -0500, MIcah Galizia wrote:
> [...]
>
>>> +
>>> +    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).

I think ive fixed this, if not i need the mp3 file that is failing to be
detected quicker


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

so your code is buggy ...


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

dont reconnect, but keep reading more data


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

iam against adding random hacks to patch over bugs

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- 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/20100228/3e35e2bb/attachment.pgp>



More information about the ffmpeg-devel mailing list