[Ffmpeg-devel] [PATCH] reduce MAX_SCAN_PACKETS in mpegts.c

Måns Rullgård mru
Sat Aug 26 22:43:44 CEST 2006

Michael Niedermayer <michaelni at gmx.at> writes:

> Hi
> On Sat, Aug 26, 2006 at 06:08:19PM +0200, Nico Sabbi wrote:
>> Hi,
>> the current mpegts demuxer is unbearably slow because it wants to scan the
>> first 32000 packets (corresponding to almost 6MB) to find usable programs,
>> making this demuxer unusable for non local streams (lan, dvb, etc).
>> This patch reduces MAX_SCAN_PACKETS to 512 (96KB) that should be enough
>> for any decently interleaved stream (out of all my samples not one couldn't
>> be played with this patch applied).
> iam not mpeg-ts demuxer maintainer but IMHO this is unacceptable, make it
> user selectable or use timestamps or even time()

Yes, use timestamps, e.g. PCR from the first PID seen carrying it
(there may be several independent time bases in a single stream).
Beware of discontinuities though.

> such change the packet num / byte amount threshold patches just lead to a
> neverending game of delay vs. support highbitrate file x

Quite.  IIRC that value was increased some time to make an HD MPEG2
stream playable.

M?ns Rullg?rd
mru at inprovide.com

More information about the ffmpeg-devel mailing list