[Live-devel] True push DeviceSource

Ross Finlayson finlayson at live555.com
Tue Oct 22 06:13:36 PDT 2013


> I am confused as how the event mechanism works in live555. I have a source that is fed with video and audio frames and I want to trigger doGetNextFrame() of my custom DeviceSource so that those frames are streamed using live555. For this I am using
> 
> 
> m_eventID = envir().taskScheduler().createEventTrigger(deliverFrame0);
> envir().taskScheduler().triggerEvent(m_eventID, this);

The "this" in the "triggerEvent()" call is wrong, because you should not be calling "triggerEvent()" from within one of your 'DeviceSource' class's member functions.  "triggerEvent()" should be called from a *separate thread* - the thread that is doing your encoding.  Because this separate thread is not the LIVE555 thread, then "triggerEvent()" is the *only* LIVE555 code that it is allowed to be calling.


> void MyStreamingDeviceSource::deliverFrame0(void* clientData)
> {
>    ((MyStreamingDeviceSource*)clientData)->doGetNextFrame();
> }

No, don't do this.  "deliverFrame0()" should call "deliverFrame()", as illustrated in the "DeviceSource" code.


> But doGe[Next]tFrame is called when I called videoSink->startPlaying() too which is not valid for me as I dont have any data yet to stream.

That's OK.  When data later *does* become available, then your separate 'encoder' thread will call "triggerEvent()", and then "deliverFrame()" will be called.


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/20131022/ac72319f/attachment-0001.html>


More information about the live-devel mailing list