[Live-devel] Behavior of DeviceSource::doGetNextFrame() when no data available
Clem Taylor
clem.taylor at gmail.com
Thu Aug 10 08:53:44 PDT 2006
On 8/10/06, David Arnold <darnold at futurec.net> wrote:
> What should a DeviceSource, such as a frame grabber, do in doGetNextFrame()
> when it determines there is no frame available? I find no answer in the
> FAQ. The comment in DeviceSource.cpp reads:
You need to reschedule a retry.
In my device source (which I copied from one of the examples), after
reading and validating the frame from the device it uses
scheduleDelayedTask with a 0 delay to schedule a call to
'afterGetting'. If a frame is not available it uses
scheduleDelayedTask to retry reading a frame from the device at some
point in the future. If you have a read selectable file descriptor for
your device then there is a more efficient method to do this.
For example:
/* poll again in 5ms */
nextTask() = envir().taskScheduler().scheduleDelayedTask (
5 * 1000, (TaskFunc*) dspRetryGet, this );
--Clem
More information about the live-devel
mailing list