[Live-devel] One stream to multiple clients

Tom Deblauwe tom.deblauwe at vsk.be
Thu Jun 14 06:01:50 PDT 2007


Ross Finlayson wrote:
> Yes, our RTSP server implementation takes care of that, *provided 
> that* you set the "reuseFirstSource" parameter to True when you 
> create each "ServerMediaSubsession" object.
>   

Nice!

So, I was checking out the whole picture of the library, just trying to 
understand it. It's a pity there is not a good overview of the different 
classes and how they are used. So after looking at the sources, I will 
try to explain here, correct me if I'm wrong!

To implement your own RTSP server, subclass RTSPServer, and reimplement 
lookupServerMediaSession.
A media session represents a RTSP URL that a client can ask of the RTSP 
server, and represents one source of video and/or audio data. In 
lookupServerMediaSession, you check if the session already exists, and 
if not, create a standard one using the static function createNew of 
ServerMediaSession. Then you need to add a subsession to this session, 
and then you add the ServerMediaSession to your RTSP server object using 
rtspServer->addServerMediaSession.
A subsession class is subclassed from OnDemandServerMediaSubsession and 
implements createNew to create a new subsession to add to your session. 
Also you reimplement createNewRTPSink so you can stream TO the 
network(from a file or whatever). This function must give back a RTPSink 
object. So you need to subclass MultiFramedRTPSink(see SimpleRTPSink for 
an example), and use it to create that RTPSink object. As far as I 
understand, the RTPSink object gives us the chance to set some RTP 
specific parameters like a marker bit or something, according to the 
contents of the individual RTP packet that will be sent out. 
SimpleRTPSink sets the marker bit on the last packet of a big frame for 
example.
You also need to subclass createNewStreamSource of the 
OnDemandServerMediaSubsession class if you want to be able to receive 
data FROM the network. You need to give a FramedSource pointer in this 
function. So from now on, I'm not so sure anymore :) So we have a bunch 
of classes that contain the name 'Framer' in them, which are subclasses 
of FramedSource, and which write the incoming data again in a file in 
most cases I think. We have also MultiFramedRTPSource which is also a 
FramedSource. SimpleRTPSource is subclassed of this class. So we can 
return an object of this class in createNewStreamSource.
Now I can't explain any further how the sink gets it's incoming data, 
and how the source gets the data, where is it? I don't understand. Can 
someone point me out here?

Thanks a lot,
Best regards,
Tom Deblauwe

So you need to subclass FramedFilter and implement the createNew 
function. A FramedFilter is also a FramedSource, and so you (must?) 
return an instance of your subclass in the createNewStreamSource 
function. How the





More information about the live-devel mailing list