[Live-devel] lead to a high CPU percentage without setting the gateway ip address

Cheng Lei lcheng at grandstream.com
Mon Apr 28 18:17:51 PDT 2014


I just use command "testRTSPClient rtsp://192.168.122.199" to receive h.264
stream from an ip camera, not using multicast.

I've noticed the client can't get local ip address using "ourIPAddress"
function when the default gateway ip is missed.

"ourIPAddress" will send a multicast packet to get local ip.

Using gprof as ROSS told me, I got this:

*without gateway ip:*

   - Each sample counts as 0.01 seconds.
   -   %   cumulative   self              self     total
   -  time   seconds   seconds    calls  us/call  us/call  name
   -  23.53      0.08     0.08                             write
   -  11.76      0.12     0.04                             sendto
   -   5.88      0.14     0.02                             close
   -   5.88      0.16     0.02                             recvmsg
   -   5.88      0.18     0.02                             vfprintf
   -   2.94      0.19     0.01      203    49.26    49.26
    DummySink::afterGettingFrame(unsigned int, unsigned int, timeval, unsigned
   int)
   -   2.94      0.20     0.01
   _IO_default_xsputn
   -   2.94      0.21     0.01
   ourIPAddress(UsageEnvironment&)
   -   2.94      0.22     0.01
   DelayQueue::synchronize()
   -   2.94      0.23     0.01
   FramedSource::afterGetting(FramedSource*)
   -   2.94      0.24     0.01                             ___xstat64
   -   2.94      0.25     0.01                             __tzstring
   -   2.94      0.26     0.01                             _int_malloc
   -   2.94      0.27     0.01                             _xstat
   -   2.94      0.28     0.01                             make_request
   -   2.94      0.29     0.01                             mempcpy
   -   2.94      0.30     0.01                             our_random
   -   2.94      0.31     0.01                             puts
   -   2.94      0.32     0.01                             select
   -   2.94      0.33     0.01                             setsockopt
   -   2.94      0.34     0.01                             socket
   -   0.00      0.34     0.00      205     0.00     0.00
    DummySink::continuePlaying()
   -   0.00      0.34     0.00      203     0.00    49.26
    DummySink::afterGettingFrame(void*, unsigned int, unsigned int, timeval,
   unsigned int)
   -   0.00      0.34     0.00       11     0.00     0.00
    operator<<(UsageEnvironment&, RTSPClient const&)
   -   0.00      0.34     0.00        9     0.00     0.00
    operator<<(UsageEnvironment&, MediaSubsession const&)
   -   0.00      0.34     0.00        4     0.00     0.00
    setupNextSubsession(RTSPClient*)
   -   0.00      0.34     0.00        3     0.00     0.00
    continueAfterSETUP(RTSPClient*, int, char*)
   -   0.00      0.34     0.00        3     0.00     0.00
    DummySink::createNew(UsageEnvironment&, MediaSubsession&, char const*)
   -   0.00      0.34     0.00        3     0.00     0.00
    DummySink::DummySink(UsageEnvironment&, MediaSubsession&, char const*)
   -   0.00      0.34     0.00        1     0.00     0.00
    continueAfterPLAY(RTSPClient*, int, char*)
   -   0.00      0.34     0.00        1     0.00     0.00
    continueAfterDESCRIBE(RTSPClient*, int, char*)
   -   0.00      0.34     0.00        1     0.00     0.00
    openURL(UsageEnvironment&, char const*, char const*)
   -   0.00      0.34     0.00        1     0.00     0.00
    ourRTSPClient::createNew(UsageEnvironment&, char const*, int, char const*,
   unsigned short)
   -   0.00      0.34     0.00        1     0.00     0.00
    ourRTSPClient::ourRTSPClient(UsageEnvironment&, char const*, int, char
   const*, unsigned short)
   -   0.00      0.34     0.00        1     0.00     0.00  main


*with gateway ip:*

   - Each sample counts as 0.01 seconds.
   -   %   cumulative   self              self     total
   -  time   seconds   seconds    calls  Ts/call  Ts/call  name
   -  53.33      0.08     0.08                             write
   -  13.33      0.10     0.02                             _int_malloc
   -   6.67      0.11     0.01
   BasicUsageEnvironment::operator<<(char const*)
   -   6.67      0.12     0.01                             cfree
   -   6.67      0.13     0.01                             new_do_write
   -   6.67      0.14     0.01                             recvfrom
   -   6.67      0.15     0.01                             vfprintf
   -   0.00      0.15     0.00      337     0.00     0.00
    DummySink::continuePlaying()
   -   0.00      0.15     0.00      335     0.00     0.00
    DummySink::afterGettingFrame(void*, unsigned int, unsigned int, timeval,
   unsigned int)
   -   0.00      0.15     0.00      335     0.00     0.00
    DummySink::afterGettingFrame(unsigned int, unsigned int, timeval, unsigned
   int)
   -   0.00      0.15     0.00       11     0.00     0.00
    operator<<(UsageEnvironment&, RTSPClient const&)
   -   0.00      0.15     0.00        9     0.00     0.00
    operator<<(UsageEnvironment&, MediaSubsession const&)
   -   0.00      0.15     0.00        4     0.00     0.00
    setupNextSubsession(RTSPClient*)
   -   0.00      0.15     0.00        3     0.00     0.00
    continueAfterSETUP(RTSPClient*, int, char*)
   -   0.00      0.15     0.00        3     0.00     0.00
    DummySink::createNew(UsageEnvironment&, MediaSubsession&, char const*)
   -   0.00      0.15     0.00        3     0.00     0.00
    DummySink::DummySink(UsageEnvironment&, MediaSubsession&, char const*)
   -   0.00      0.15     0.00        1     0.00     0.00
    continueAfterPLAY(RTSPClient*, int, char*)
   -   0.00      0.15     0.00        1     0.00     0.00
    continueAfterDESCRIBE(RTSPClient*, int, char*)
   -   0.00      0.15     0.00        1     0.00     0.00
    openURL(UsageEnvironment&, char const*, char const*)
   -   0.00      0.15     0.00        1     0.00     0.00
    ourRTSPClient::createNew(UsageEnvironment&, char const*, int, char const*,
   unsigned short)
   -   0.00      0.15     0.00        1     0.00     0.00
    ourRTSPClient::ourRTSPClient(UsageEnvironment&, char const*, int, char
   const*, unsigned short)
   -   0.00      0.15     0.00        1     0.00     0.00  main


I still don't know where is the problem. Please help.



On Tue, Apr 29, 2014 at 4:15 AM, Warren Young <warren at etr-usa.com> wrote:

> On 4/28/2014 02:34, Cheng Lei wrote:
>
>>
>> If delete default gateway ip addrss, then run the test program
>> testRTSPClient, CPU percentage is 6%, then I add the default gateway ip
>> by using cmd such as "route add default gw 192.168.122.1", CPU decrease
>> to 1%. If you guys know the issue, please help, thanks.
>>
>
> Are the streams you're setting up via RTSP multicast, by chance?  I have
> noticed that the Linux network stack seems to require a gateway to do
> multicasting correctly, even when the packets never leave the LAN.
>
> If you absolutely cannot have a real gateway IP, try using the machine's
> own IP as the "gateway" address.  That is usually enough to placate the
> routing layer of the stack.
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140429/b03bf83b/attachment-0001.html>


More information about the live-devel mailing list