[vls-devel] Re: Patch to regulate network output
Jean-Paul Saman
jpsaman at wxs.nl
Tue Mar 4 15:39:22 CET 2003
Marian Durkovic wrote:
> Hi all,
Hi,
Thanks for sending us a patch. It is well written and clean.
>
>
> in order to solve the problem with large packet bursts I've modified the
> netoutput.cpp to ensure that appropriate gap is inserted after each packet
> sent to the network. The gap is calculated from the new config parameter
> MaxMbps assuming that 10 Mbps stream needs to send 1000 packets/s
> (gap = 1 milisecond). When this parameter is unset, no traffic averaging
> is performed.
>
Unfortunatley I do not think this is the way to resolve that issue. This
is more a workaround without solving the *real* problem. Netoutput
directly writes the packets (an entire UDP packet, with 7 TS packets) to
the network stack. At this moment the UDP packet is handled by the kernel.
So when the kernel has time it will send the packet to the network card.
On a stock Linux kernel (even with most distributions) this might take
200 ms (worst case). This depends on kernel locks. So when a lock is
active nothing other can be done and the packets will have to wait. To
solve this issue a preemptive kernel with the lockbreaking patches will
be needed. This will give the kernel a IRQ latency of 1.5ms and will
solve the 200 ms worst case.
VLS does an approximation of the original bitrate through extrapolation
upon the PCR's found in the stream. To correctly reproduce the original
bitrate VLS should do intrapolation of the PCR's instead of
extrapolation. This should solve the bursty behaviour when sending
packets. The *offending* code is in /src/server/tsstreamer.cpp,
functions AdjustClock(), WaitSendDate(). These should be fixed.
> One issue related to this is that the standard nanosleep() on Linux
> typically sleeps for minimum 20 miliseconds (!) so in order to have this
> functionality, we need the high-resolution-timers compiled into the kernel
> - see http://sourceforge.net/projects/high-res-timers/
Also VLS uses nanosleep to do timing so it will benefit from the
high-resolution-timers too. Also a preemptive kernel with lockbreaking
patches is needed (http://sourceforge.net/kpreempt and
http://www.tech9.net/rml/linux/)
Greetings,
Jean-Paul Saman.
--
This is the vls-devel mailing-list, see http://www.videolan.org/streaming/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>
More information about the vls-devel
mailing list