[Live-devel] Push (instead of Pull) to custom DeviceSource
Ross Finlayson
finlayson at live555.com
Thu Oct 11 17:59:36 PDT 2007
>I'd like to just call doGetNextFrame() at my own pace when I have data
>ready for it.
No, "getNextFrame()" (and thus "doGetNextFrame()") must be called by
the downstream object, when it is willing to receive data - i.e., the
'pull' model.
What you can do, however, is arrange to call your "deliverFrame()"
function (*not* "doGetNextFrame()") when data becomes available. The
best way to do this is to have "the availability of new data" be an
'event', that gets handled within the event loop.
Is your input device an open file (this is often true if you're
running a Unix (including Linux) system)? If so, then you can do
this easily using "TaskScheduler::turnOnBackgroundReadHandling()".
If not, then you can use the "watchVariable" feature of
"doEventLoop()" to do this - along with a separate thread that
watches for the availability of new data, and sets the
"watchVariable" when this happens. (See the FAQ.) (Alternatively,
you could write your own "TaskScheduler" subclass in order to make
the availability of new data an 'event', but that is far more
complicated to do.)
--
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list