[Live-devel] How to implement non-blocking fashion in custom doGetNextFrame()

Ross Finlayson finlayson at live555.com
Fri Feb 29 20:50:00 PST 2008


>The problem is, deliverFrame returns the very first frame OK, then
>doGetNextFrame is called again before a new frame is captured, and I
>return immediately. Then, I don't know why, liveMedia never calls
>doGetNextFrame again. It just stays stuck and apparently does nothing.
>
>Why?

Because you are not delivering data to the downstream caller, and 
then calling "FramedSource::afterGetting(this);".  Note that every 
incoming call to "doGetNextFrame()" must *eventually* result in (i) 
delivering data to the caller, and (ii) a call to 
"FramedSource::afterGetting(this);", to tell the downstream caller 
that delivery has been completed.

The arrival (capture) of new frame data needs to be signalled 
(somehow) within the event loop, so that your implementation can 
notice it, and then call your "deliverFrame()" function.  If your 
capture device is a socket, then you can easily do this using 
"TaskScheduler::turnOnBackgroundReadHandling()".  If, however, your 
capture device is not a socket, then you can instead signal the 
arrival of new data by writing a new event loop (e.g., by subclassing 
"TaskScheduler"), or perhaps more simply by using the existing 
"watchVariable" feature (see the FAQ).
-- 

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


More information about the live-devel mailing list