[FFmpeg-devel] [HACK] Remove MAX_STREAMS usages

Ronald S. Bultje rsbultje
Fri Aug 13 16:12:01 CEST 2010


On Fri, Aug 13, 2010 at 2:51 AM, Reimar D?ffinger
<Reimar.Doeffinger at gmx.de> wrote:
> You can add such a limit to the new av_new_stream function, this is no
> problems since we can then change or remove it without an API change.
> However, if it is relevant to security, I think it is far preferable
> to have the MMS code do any necessary checks.

Not for security per se, more for ridiculous memory use of an
otherwise valid file with a million streams. Such a file would be
valid but surely not right. A check in av_new_stream() makes sense

The reason MMS checks for it is because MMS needs to tell the server
which streams to enable, to prevent us from downloading streams we're
not listening to, thus preserving bandwidth and allowing clients to
select the optimal bitrate for their connection. RTSP and other
network protocols have similar functionality. However, these layers
don't act at the demuxer level and thus don't use av_new_stream(),
thus they need access to that same value/variable as well.

MMS uses it to make a LUT between the "ASF stream ID" and the index of
the stream in the lookup table, so we can tell the server which
streams to send using the "ASF stream ID". This is usually an integer
that increments with stream number and starts at 1 (rather than 0),
but I'm not sure if that's required by a standard. Some files might
use different values.


More information about the ffmpeg-devel mailing list