[Live-devel] doGetNextFrame interval

Ross Finlayson finlayson at live555.com
Sat Oct 11 08:14:17 PDT 2014


> I see what you mean, and fDurationInMicroseconds is being calculated correctly. For my fragmentation issue, If I don't call afterGetting() then doGetNextFrame() is not ever re-invoked, so the server essentially stops on the first partial read. 
> 
> Is there a method or variable I should set to indicate to Live555 that I want to continue accumulating data?

Your "doGetNextFrame()" implementation should call "FramedSource::afterGetting()" *only* when you have a complete frame that you want to deliver to the downstream object.  If you don't yet have a complete frame, then simply return, without calling "FramedSource::afterGetting()".  If you do that, then "doGetNextFrame()" won't get called again in the meantime.

But, you're probably thinking, if "doGetNextFrame()" simply returns without completing delivery of a frame, and doesn't get called again, then how can I figure out when I later get enough data to deliver?  Basically, that has to be an 'event' that gets handled within the event loop.  One way to do this is by 'polling' - i.e., by scheduling a periodic delayed task (using "TaskScheduler::scheduleDelayedTask()") that checks whether you have enough data (and then calls "FramedSource::afterGetting()" when you do have enough data).  Another way is to have a separate thread that's gathering data, and then have this thread use an 'event trigger' (by calling "TaskScheduler::triggerEvent()") to signal when data is ready to be delivered.  For an example of this, see the 'DeviceSource' code in "liveMedia/DeviceSource.cpp".  (Note that if you do this, then "TaskScheduler::triggerEvent()" is the *only* LIVE555 function that the separate 'data gathering' thread is allowed to call; see <http://www.live555.com/liveMedia/faq.html#threads>).


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20141011/77bfe87e/attachment.html>


More information about the live-devel mailing list