[Live-devel] Adding streams to already-running event loop
Eric Blanpied
eric at sparkalley.com
Tue Nov 11 12:23:13 PST 2014
>
>> With a single event loop, how does one add new client requests to the already running loop?
>
> You can create new “RTSPClient” objects and call operations on them (including “sendDescribeCommand()”) from within the event loop, at any time. I.e., this could be done from code that’s called to handle an event.
>
> Your next question is probably: How do I get the event loop to handle an event? See http://www.live555.com/liveMedia/faq.html#other-kinds-of-event
OK, having studied deviceSource.cpp, I have some idea about how this works. Seems like you register with the scheduler for a callback, then once called you’re safe to make calls that effect the loop.
But there are still questions:
1. In this case (vs. deviceSource) I’m unclear what class I’d set up the eventTrigger on. On my RTSPClient subclass? Perhaps a new class that encapsulates the whole rtsp “service” i’m putting together, or on my subclass of UsageEnvironment?
2. Any restrictions on multiple eventTriggerIds per class?
Guessing that the RTSPClient subclass might be a good place, here’s some pseudocode.
class myRTSPClient: public RTSPClient{
<snip constr, etc.>
public:
EventTriggerId addStreamEventTriggerId;
EventTriggerId stopStreamEventTriggerId;
private:
void addStreamToLoop();
void stopStream();
}
myRTSPClient::createNew(env,url,etc.){
…
addStreamEventTriggerId = envir().taskScheduler().createEventTrigger(addStreamToLoop);
}
myRTSPClient::addStreamToLoop(){
this->sendDescribeCommand(continueAfterDESCRIBE);
}
myClient = myRTSPClient::createNew(env, url, etc.);
ourScheduler->triggerEvent(myRTSPClient::addStreamEventTriggerId, myClient);
On the right track?
thanks!
-eric
More information about the live-devel
mailing list