[Live-devel] What to do if data not coming while streaming from memory

Ross Finlayson finlayson at live555.com
Fri Aug 1 22:21:10 PDT 2014


> Maybe the speed of streaming frames is much faster than the speed of generating frames. So when function “doGetNextFrame()” is called, no frame is put into memory. If I use sleep() to wait for frames, thread blocks and streaming AAC frames slowns down.

No, you shouldn't call "sleep()" at all, because that will stop events from being handled during that period of time.  Remember that LIVE555-based applications are event driven, using a single thread of control - with asynchronous I/O - to handle events.  Therefore, the LIVE555 event loop should not block.


> So What should I do  to  ensure both AAC and H.264 to streamed well when no frames come?

If your "doGetNextFrame()" is called when no frames are immediately available to be delivered, then it should return immediately (i.e., without calling "sleep()"), and should be called again when a new frame becomes available.  One way to do this is to use a separate thread that monitors your frame source, and 'triggers' the LIVE555 event loop thread - by calling "triggertEvent()".

I suggest that you use the "DeviceSource" code (see "liveMedia/DeviceSource.cpp") as a model for your 'frame source' class.


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/20140802/be31b583/attachment.html>


More information about the live-devel mailing list