[Live-devel] doEventLoop()

Austin Snow asnow at pathfindertv.net
Fri Dec 26 17:30:57 PST 2008


The call to doGetNextFrame (doGetNextFrame(void *data, int len) in my  
code) only happens when data is present.  Than in (doGetNextFrame(void  
*data, int len) in my code) function I call deliverFrame(data, len);  
function passing the data.

But the function deliverFrame(data, len); the if statement if (! 
isCurrentlyAwaitingData()) return; (part of deviceSource.cpp) returns  
most of the time, so only 1 frame in ~5 make into fTo.

In deliverFrame function, which of the following is correct?

   FramedSource::afterGetting(this);  <-only 1 and 5 frames
or
   nextTask() = 	envir().taskScheduler().scheduleDelayedTask(0,  
(TaskFunc*)afterGetting, this);  <-this gives the error  
"getNextFrame(): attempting to read more than once at the same time!"

Thanks
Austin

On Dec 26, 2008, at 7:59 PM, Ross Finlayson wrote:

>> 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/
> _______________________________________________
> 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/20081226/9600bf5b/attachment.html>


More information about the live-devel mailing list