[Live-devel] How to create multiple RTSP clients using threads for live video source playing at same time?

Ross Finlayson finlayson at live555.com
Thu Dec 29 06:28:25 PST 2011


> Thanks for your reply. Now, I can play multiple streams concurrently after I take the testRTSPClient program as an example.  But this works OK  when I provide all  URLs  at one time and then call the doEventLoop(). How can I make it work so that I can play another stream after other streams have arlready started but haven’t stoped playing (with one thread control not using threads)?

First, the easiest way to do this is to run each RTSP client in a separate *process* (i.e., in a separate application, *not* as a separate thread within a single application).  If you do not need to share memory between the stream receivers, then this is the simplest solution.

The rest of this message, however, assumes that - for whatever reason - you want all of your stream receivers to run in the same application (i.e., process).

How to start playing another stream?  This depends - What decides when a new stream should be played?  Whatever this is, it will need to be handled as an "event", within the event loop.

Perhaps, for example, you have a GUI - running in a different thread - where the user indicates (perhaps by filling in a form and clicking a button) that a new stream should be started.  In this case, you could use the "EventTrigger" mechanism that's defined for the "TaskScheduler" class: See
	http://www.live555.com/liveMedia/faq.html#other-kinds-of-event

Or perhaps you have a TCP socket connected to a console that the user is using to type commands (e.g. "start-playing <rtsp-url>").  In this case, this 'command-line user interface' TCP socket could be read and parsed from within the event loop - using a handler that's set up using the "TaskScheduler:turnOnBackgroundReadHandling()" routine.

But whatever you do, the 'event' that determines that a new stream needs to be played is an 'event' that will need to be handled within the event loop.

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/20111229/a88c9a4e/attachment.html>


More information about the live-devel mailing list