[Live-devel] 100% cpu usage when 1 or more client connects to RTSP server

Ross Finlayson finlayson at live555.com
Thu Mar 12 05:21:08 PDT 2015


> What's happening is that the BasicUDPSource::incomingPacketHandler1() function is being called too many times.

This is apparently happening due to a flaw in your runtime library and/or OS: “select()” (called each time within the event loop) is returning an indication that the UDP socket has incoming packet(s) available - when it doesn’t.

Unless you can fix this problem (again, in your system, not in our code), then you’re going to have to use some other input mechanism than UDP packets.  Is the input source (running “ffmpeg”) running on the same computer as the RTSP server?  If so, then you don’t need to use network packets to communicate between them.  Instead, I suggest using a named pipe (and thus using a “MPEG2TransportFileServerMediaSubsession” rather than a “MPEG2TransportUDPServerMediaSubsession”.


> I modified the line to:
> if (!isCurrentlyAwaitingData()) {usleep(500);return;}
> 
> And since then the CPU usage does not go up to 100% but stays around 1%! :)

Yes, of course your CPU usage drops to almost nothing if you’re spending almost all of your time blocked in “usleep()” (and are thus unavailable to do any real work).  Obviously that’s not a real solution to your problem.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20150313/d89bdec4/attachment.html>


More information about the live-devel mailing list