[Live-devel] doEventLoop()

Ross Finlayson finlayson at live555.com
Fri Dec 26 16:59:13 PST 2008


>Hello All,
>I have created my own deviceSource.cpp for my live input from QTKit, 
>I call doGetNextFrame with my data and than pass it to deliverFrame. 
> I have based my streaming from MPEG4ToVideoStreamer, which blocks 
>at env->taskScheduler().doEventLoop(); // does not return and does 
>not allow my live input code to continue.  It there a way to allow 
>my other code to continue.

"deliverFrame()" should be called *only when* data is available to be 
delivered to the downstream object.  (Your "doGetNextFrame()" 
implementation should return immediately - without calling 
"deliverFrame()" - if no data is currently available to be delivered.)

This means that the availabllty of new data needs to be 
recognized/handled as an 'event' by the event loop.

Unfortunately there's no one standard way of handling the arrival of 
new data as an 'event', because it depends on your particular 
environment (in particular, the nature of your input device).  If 
your input device can be treated as an open file, then it's easy, 
because you can use the event loop's existing "select()" mechanism, 
by calling "TaskScheduler:: turnOnBackgroundReadHandling()" (see the 
comments in "DeviceSource.cpp").  You should do it this way, if you 
can.

If, however, your input device cannot be treated as an open file, 
then you have to do something else to handle the arrival of new data 
as an 'event'.  Some people use the optional "watchVariable" 
parameter (to "TaskScheduler::doEventLoop()") for this purpose. 
(See, for example, 
<http://lists.live555.com/pipermail/live-devel/2005-September/003276.html>. 
Note, however, that if you use the 'watchVariable' feature, you 
should also note this point: 
<http://lists.live555.com/pipermail/live-devel/2006-March/004192.html>)

An alternative way to recognize the arrival of new data as an event 
would be to subclass "TaskScheduler" to implement your own event loop 
- but that is more difficult.
-- 

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


More information about the live-devel mailing list