[Live-devel] ForceMulticastOnUnspecified

xcsmith at rockwellcollins.com xcsmith at rockwellcollins.com
Mon Jan 8 12:45:40 PST 2007


It is the server that decides whether or not a
stream is multicast or unicast.  It specifies this in its response to
the initial RTSP "DESCRIBE" command (and it's not something that the
client can change in its subsequent "SETUP" command).

Ross,

Thank you for your reply.
The SDP that I receive from testOnDemandRTSPServer has the following lines:

m=video 0 RTP/AVP 33
c=IN IP4 0.0.0.0

In the SDP I don't see that the server specifies unicast.  The sessions are
set up ahead of time as unicast though, i see your point.  I thought I
could use multicast because of the parameter forceMulticastOnUnspecified in
the function RTSPClient::setupMediaSubsession().  What is the meaning of
this parameter then if I cannot force multicast on a session who's SDP has
"0" in the address / port information?

I want in the end to use mediaServer and have the sessions created
dynamically as multicast sessions if the client transport string says
multicast.  I am confused about how to do this using
PassiveServerMediaSubsession.  In the examples of using
PassiveServerMediaSubsession, the RTPSink is created ahead of time and
sink->startPlaying() is called before the event loop is entered.  Is it
reasonable to use PassiveServerMediaSubsession with mediaServer?  Will I
have to modify anything so that handleCmd_PLAY() will set the stream
playing?  What I really need is an "on demand" multicast session.

I implemented a class inherited from FileServerMediaSubsession with the 2
pure virtual functions done using the setup in testMPEG2TransportStreamer:

FramedSource* mySub::createNewStreamSource(unsigned /*clientSessionId*/,
unsigned& estBitrate)
{
   estBitrate = 5000; // kbps, estimate

  // Create the video source:
   unsigned const inputDataChunkSize
         = TRANSPORT_PACKETS_PER_NETWORK_PACKET*TRANSPORT_PACKET_SIZE;
   ByteStreamFileSource* fileSource
         = ByteStreamFileSource::createNew(envir(), fFileName,
inputDataChunkSize);
   if (fileSource == NULL) return NULL;

   MPEG1or2Demux* demux = MPEG1or2Demux::createNew(mEnv, fileSource);
   MPEG1or2DemuxedElementaryStream* pesSource = demux->newRawPESStream();
   FramedSource* tsFrames =
MPEG2TransportStreamFromPESSource::createNew(mEnv, pesSource);

  // Create a framer for the Transport Stream:
   return MPEG2TransportStreamFramer::createNew(envir(), tsFrames);
}

RTPSink* mySub::createNewRTPSink(Groupsock* rtpGroupsock,
                     unsigned char /*rtpPayloadTypeIfDynamic*/,
                     FramedSource* /*inputSource*/)
{
   return SimpleRTPSink::createNew(envir(), rtpGroupsock,
         rtpPayloadType, 90000, "video", "mp2t",
         1, True, False /*no 'M' bit*/);
}

I have mediaServer DynamicRTSPServer create an instance of this class
whenever there is a file with ".mpg" extension, and so far I think it
works.  Now I want to make it so the reformatted stream can be multicast.
There aren't any functions similar to createNewRTPSink() and
createNewStreamSource() in PassiveServerMediaSubsession, so I would have to
do this setup somewhere else, and I don't know where to put the setup if I
use mediaServer.   Do you have advice on this?

(And I think there was a mistake in the client transport line i posted
earlier.   I think it should be: "
RTP/AVP;multicast;destination=224.0.1.2;client_port=12008-12009".)

Thanks very much!
Xochitl



More information about the live-devel mailing list