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

詹明 zhanm at join.net.cn
Thu Dec 29 05:49:44 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)?

 

发件人: live-devel-bounces at ns.live555.com
[mailto:live-devel-bounces at ns.live555.com] 代表 Ross Finlayson
发送时间: 2011年12月26日 13:36
收件人: LIVE555 Streaming Media - development & use
主题: Re: [Live-devel] How to create multiple RTSP clients using threads for
live video source playing at same time?

 

  I want to create a rtsp server that supports multiple live video source
playing using threads.  I have created my custom live source, sink and
session object and modified MediaSubsession::initiate to handle it. I
created multiple rtspclients using threads to use my own session.  The
problem is: I can play only one session. Do I need to create separate
subsessions for each live channel playing using different urlsurfix?  How
can I synchronize between these clients?

 

Unfortunately I found your question a little confusing.  It wasn't clear to
me whether (1) your question was about a RTSP server (How to set up a RTSP
server that supports multiple streams?), or whether (2) your question was
about RTSP clients (How to create multiple, concurrent RTSP clients?).

 

If your question is (1) (How to set up a RTSP server that supports multiple
streams?), then I suggest that you look at the code for the
"testOnDemandRTSPServer" for guidance, and also read the FAQ entries that
discuss how to have a server that streams from live source(s).  Note, in
particular, that each stream (e.g., coming from a specific video+audio
source) has its own "ServerMediaSession", with its own name (which gets used
in the "rtsp://" URL that will be used to access the stream).  Each
particular track within the stream (e.g., audio, video, text) will have its
own "ServerMediaSubsession".  Once again, the "testOnDemandRTSPServer" code
should make this clearer.

 

If your question is (2) (How to create multiple, concurrent RTSP clients?),
then there are several possible ways to do this:

- Create multiple processes, each receiving its own "rtsp://" URL.  For
example, you can run multiple copies of the "openRTSP" application - which
will require no extra programming at all.

- Write a single application (i.e., process) that opens/receives multiple
concurrent "rtsp://" URLs, using a single thread of control.  See the code
for the "testRTSPClient" demo application for guidance on how to do this.

- Write a single application (i.e., process) that opens/receives multiple
concurrent "rtsp://" URLs, using multiple threads (one thread for each
"rtsp://" URL).  This approach is possible, although not recommended.  If
you really want to do this, then you need to read and understand the FAQ
entry about threads.  (Note, in particular, that each thread *must* use a
separate "TaskScheduler" and "UsageEnvironment".)

 

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/41bb2e47/attachment-0001.html>


More information about the live-devel mailing list