[Live-devel] Stop specific streams.

Ross Finlayson finlayson at live555.com
Fri Dec 9 08:40:35 PST 2011


> So I am trying to create a event trigger, but I am unsure on how to proceed. The taskScheduler->createEventTrigger() function expects a taskFunc object and I am not sure what this is.

It's quite simple.  It's this:
	typedef void TaskFunc(void* clientData); 
I.e., it's a void function that takes a "void*" as argument.

>  Is it similar to a callback?

Yes, but it's 'called back' from within the event loop, when the event is 'triggered'.

> If so, how do I cast my function do a taskFunc object? I currently having something like this, which is way off:
>  
> void killStream() {};

"kilStream()" needs a single void* parameter.  Don't you want to specify a specific stream that you want to 'kill'?  If so, then you can use that as your parameter (cast it to a void*) when you later call "triggerEvent()".
 
> taskSched->createEventTrigger(&killstream);

Yes, but you'll need to remember the result "EventTriggerId" of this call, so you can later use it in your call to "triggerEvent()".

If you're still unsure about how to use event triggers, then you can see an example in "liveMedia/DeviceSource.cpp".


>  I am also still unsure about the mechanisms for actually stopping the streams.

OK, this is a completely different question.

To remove (and delete) a "ServerMediaSession" object from the server, simply call 
	RTSPServer::removeServerMediaSession()
***Do not*** call "Medium::close()" on the "ServerMediaSession" object; that is done automatically by "removeServerMediaSession()".  Note, however, that although this will prevent any future clients from accessing this stream, it will not stop any streaming that's current ongoing for this "ServerMediaSession".  If you want to do that, you would need to delete the "RTSPServer::RTSPClientSession" object for each currently active client.  (This has the same effect as the client having done a RTSP "TEARDOWN".)


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/20111209/d6a6d457/attachment.html>


More information about the live-devel mailing list