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

Ross Finlayson finlayson at live555.com
Mon Mar 9 17:30:04 PDT 2015


> Boolean reuseFirstSource = False;

FYI, because your input source is a live stream, you should change this from “False” to “True”, so that multiple clients can connect to the RTSP server to receive the stream, without the input stream being recreated each time.  (This, however, has nothing to do with your 100% CPU problem, which I unfortunately can’t explain; see below.)


> I've got nine audio streams that I'm pulling in via ffmpeg and then re-encoding them to AAC-LC and pushing to udp://127.0.0.1:port_num?pkt_size=1316 <udp://127.0.0.1:port_num?pkt_size=1316> (where port_num is replaced by respective port number) The first stream is being pushed to port 10000, the second one to 10001, third one to 10002, etc.
> 
> Example for first stream:
> ffmpeg -i remotestream [...codec options...] -f mpegts udp://127.0.0.1:10000?pkt_size=1316 <udp://127.0.0.1:10000?pkt_size=1316>
> 
> I've modified testOnDemandRTSPServer.cpp as shown below. (taken from live555-latest.tar.gz downloaded today - 8 March 2015)
> I launch my ffmpeg instances & the rtsp server and connect to it via VLC/another rtsp client.
> 
> It works, I do hear the audio stream, however the issue is that as soon as one client connects, the RTSP server uses 100% of the CPU.
> As soon as the client disconnects, the CPU usage falls back to normal. Any idea of what could be wrong?

Unfortunately not; what you’re doing looks correct.  Do you also see this if you have only one input stream, rather than nine?

Another thing you could try, to attempt to figure out what might be wrong:
- Run “ffmpeg” as before, to generate a Transport Stream, but output the result into a *file* (named “test.ts”), rather than UDP packets.
- Then run “testOnDemandRTSPServer”, and try playing the “mpeg2TransportStreamTest” stream.  Do you still see 100% CPU utilization even in this case?

Another thing you might check is that your “ffmpeg” command is generating correct PCR timestamps into the Transport Stream.

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/20150310/06b3f929/attachment.html>


More information about the live-devel mailing list