[Live-devel] RTCPInstance saturating the event loop

sampsa sampsa.riikonen at dasys.fi
Mon Oct 3 02:16:07 PDT 2016


Hi Ross,

I have come across a strange (?) behaviour with RTCP packet sending.

First, I create a basic task scheduler as follows:

scheduler=BasicTaskScheduler.createNew(0);

Then I execute the scheduler in an infinite loop:

while true {
   scheduler->SingleStep();
   std::cout << "ping!\n";  // just in order to see how often the event 
loop triggers off ..
   // as I am doing this in a multiprocess, I might check an event flag 
here (for exiting the process)
   // etc.
}

Now, most of the time "ping!" gets printed every now and then (say, few 
times a second, _not_ every millisecond or so), however once I start 
using "RTCPInstance", the event loop "saturates" completely, i.e. it is 
called with a very high frequency (i.e. my terminal is saturated with 
"ping!":s within an .. attosecond!) and the process shows high cpu 
consumption.

RTCP is supposed to send the absolute timestamp every second or so (i.e. 
it is a relatively "rare" event), right?

I emphasize: I am able to receive and send frames nicely, however, only 
when I enable RTCPInstance, I get the high calling frequence described 
above.

The pseudocode looks like this:

----------------
// Sources/Filters:
bytesource 
=MyByteStreamMemoryBufferSource::createNew(env,(uint8_t*)(buf),len,False,0,0);
videoSource =H264VideoStreamDiscreteFramer::createNew(env, bytesource);
// connection: bytesource -> videoSource [filter]

// Sinks:
videoSink   =H264VideoRTPSink::createNew(env, rtpGroupsock, 96);

// When creating a RTCPInstance, it "starts playing" immediately..
rtcp        = RTCPInstance::createNew(env, rtcpGroupsock, 500, cname, 
videoSink, NULL, True); // *** If I use this, it "saturates" the event 
loop! ***

// This isn't giving any problems..:
videoSink->startPlaying(*(videoSource), afterPlaying, [pars to 
afterPlaying]);
// connection: videSource [filter] -> videoSink
---------------

What am I missing here?

Is the simple answer that I should not be messing with the event loop 
(i.e. executing "scheduler->SingleStep()") under any circumstances by 
myself? - even in that case, I am baffled by the behaviour of 
"RTCPInstance".

Regards,

Sampsa




More information about the live-devel mailing list